| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace addons\BossThree\api\modules\v1\controllers;
- use addons\BossThree\common\models\BossThree;
- use common\enums\StatusEnum;
- use common\models\user\UserLevel;
- use Yii;
- use api\controllers\OnAuthController;
- use common\models\common\MallSetting;
- use Exception;
- /**
- * 佣金控制器-前端访问
- *
- * Class CommissionController
- * @package addons\SelfMall\api\modules\v1\controllers
- */
- class CommissionController extends OnAuthController
- {
- public $modelClass = '';
- /**
- * 不用进行登录验证的方法
- *
- * 例如: ['index', 'update', 'create', 'view', 'delete']
- * 默认全部需要验证
- *
- * @var array
- */
- protected $authOptional = [];
- /**
- * 佣金明细
- *
- * @return string
- */
- public function actionList()
- {
- }
- /**
- * 佣金统计接口
- * @return mixed|void
- */
- public function actionTotal()
- {
- try{
- $boss = BossThree::findOne(['mall_id' => $this->mall_id,'user_id' => $this->user['id'],'status' => StatusEnum::ENABLED]);
- $user_level = UserLevel::getUserLevelOne(['mall_id' => $this->mall_id,'level' => $this->user['level']],[],true);
- $return = [
- 'nickname' => $this->user['nickname'],
- 'username' => $this->user['username'],
- 'avatar_url' => $this->user['avatar_url'],
- 'mobile' => $this->user['mobile'],
- 'level_name' => $user_level['name'] ?: MallSetting::getDefaultLevelName($this->mall_id),
- 'settle_commission' => $boss->commission,
- 'total_commission' => $boss->total_commission,
- 'frozen_commission' => 0
- ];
- return $this->success('success',$return);
- }catch(Exception $e){
- return $this->error($e->getMessage());
- }
- }
- }
|