ShareController.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * ShareController.php UTF-8
  4. *
  5. *
  6. * @date : 2018/5/26 15:48
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\wapapp\controller\v8;
  13. use api\common\controller\V2ApiBaseController;
  14. use huo\controller\posts\ShareAct;
  15. use huolib\constant\ShareConst;
  16. use huolib\status\CommonStatus;
  17. use huolib\status\MemberStatus;
  18. class ShareController extends V2ApiBaseController {
  19. public function _initialize() {
  20. parent::_initialize();
  21. }
  22. /**
  23. * 分享上报
  24. * http://doc.1tsdk.com/138?page_id=3360
  25. * 【域名】/share/add
  26. */
  27. public function add() {
  28. $_mem_id = $this->mem_id;
  29. if (empty($_mem_id)) {
  30. $_code = MemberStatus::NO_ERROR;
  31. $this->success(lang(MemberStatus::getMsg($_code)), [], $_code);
  32. }
  33. $_game_rq = $this->setGameData();
  34. $_channel_rq = $this->setChannelData();
  35. $_device_rq = $this->setDeviceData();
  36. $_mem_rq = $this->setMemData();
  37. $_share_type = $this->request->param('share_type/s', '');
  38. if (empty($_share_type)) {
  39. $_code = CommonStatus::INVALID_PARAMS;
  40. $this->error(lang(CommonStatus::getMsg($_code)), [], $_code);
  41. }
  42. if (ShareConst::SHARE_TYPE_POSTS == $_share_type) {
  43. $_param = $this->request->param();
  44. $_act_id = $this->request->param('share_id/d', 0);
  45. if (empty($_act_id)) {
  46. $_code = CommonStatus::INVALID_PARAMS;
  47. $this->error(lang(CommonStatus::getMsg($_code)), [], $_code);
  48. }
  49. //分享成功回调处理
  50. $_rs = (new ShareAct())->callback($_game_rq, $_channel_rq, $_device_rq, $_mem_rq, $_param);
  51. return $this->returnData($_rs);
  52. } else {
  53. // TODO: liuhongliang 2018/5/28 其他分享类型
  54. $_code = MemberStatus::NO_ERROR;
  55. $this->success(lang(MemberStatus::getMsg($_code)), [], $_code);
  56. }
  57. }
  58. }