BehaviorController.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2018/8/16
  6. * Time: 10:27
  7. */
  8. namespace App\Http\Controllers\Channel\Behavior;
  9. use App\Http\Controllers\Channel\BaseController;
  10. use App\Modules\Channel\Models\Behavior;
  11. use Illuminate\Http\Request;
  12. use Illuminate\Routing\Controller;
  13. class BehaviorController extends BaseController {
  14. /**
  15. * @apiDefine behavior 用户行为
  16. */
  17. /**
  18. * @apiVersion 1.0.0
  19. * @apiDescription 用户行为上传
  20. * @api {post} behavior/upload 自主评分
  21. * @apiGroup behavior
  22. * @apiParam {String} action 点击行为 ['manual'-操作指南,'bookRecom'-书籍推荐,'noticePromote'-促销活动(通知公告),'withdraw'-提现事宜,'notice'-平台通知
  23. 'query'-用户查询,
  24. 'sumData'-数据汇总,
  25. 'promoteNovel'-小说推广,'rankNovel'-小说排行,'pagePromote'-页面推广,'businessPromote'-促销活动(推广运营),'smartPush'-智能推送,'templateMsg'-模版消息,'clientMsg'-客服消息,'picArtElem'-图文素材,'miniProgram'-小程序,'keywordRe'-关键字回复
  26. 'promoteStats'-推广统计,'pushStats'-推送统计,'rechargeRecord'-充值记录,'balanceCenter'-结算中心
  27. 'serviceAccountSet'-服务号设置,'ClientSet'-客服设置,'siteList'-站点列表]
  28. * @apiName score
  29. * @apiSuccess {int} code 状态码
  30. * @apiSuccess {String} msg 信息
  31. * @apiSuccess {object} data 结果集
  32. * @apiSuccessExample {json} Success-Response:
  33. * {
  34. * "code": 0,
  35. * "msg": "",
  36. * "data": {
  37. * }
  38. */
  39. public function userBehaviorUpload(Request $request) {
  40. if(!$request->has('action')){
  41. return response()->error('PARAM_EMPTY');
  42. }
  43. $action = $request->input('action');
  44. $hay_stack = ['manual','bookRecom','noticePromote',
  45. 'withdraw','notice', 'query', 'sumData','promotionNovel',
  46. 'rankNovel','pagePromote','businessPromote','smartPush',
  47. 'templateMsg','clientMsg','picArtElem','miniProgram','keywordRe',
  48. 'promoteStats','pushStats','rechargeRecord','balanceCenter',
  49. 'serviceAccountSet','ClientSet','siteList'];
  50. if(!in_array($action,$hay_stack)){
  51. return response()->error('PARAM_ERROR');
  52. }
  53. $data = array(
  54. 'uid'=>$this->getChannelUserId(),
  55. 'action' =>$action,
  56. );
  57. Behavior::create($data);
  58. return response()->success();
  59. }
  60. }