|
|
@@ -5,63 +5,66 @@
|
|
|
|
|
|
namespace business\controllers;
|
|
|
|
|
|
+use biz\invite\services\InviteService;
|
|
|
use common\components\stringUtil;
|
|
|
+use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
-
|
|
|
class InviteController extends BaseController
|
|
|
{
|
|
|
- protected $service = '\biz\invite\services\InviteService';
|
|
|
-
|
|
|
- // list,detail,create,update,delete
|
|
|
- protected $notAllowActions = ['update', 'delete']; // 设置方法过滤
|
|
|
|
|
|
//邀请有礼
|
|
|
- //写法参考 business/controller/UserController/list
|
|
|
public function actionList()
|
|
|
{
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $status = isset($get['status']) ? $get['status'] : '';
|
|
|
- $search = isset($get['search']) ? $get['search'] : '';
|
|
|
- $where = [];
|
|
|
- $where['merchantId'] = $this->merchantId;
|
|
|
- if($status != ''){
|
|
|
- $where['status'] = $status;
|
|
|
- }
|
|
|
- if (!empty($search)) {
|
|
|
- if (stringUtil::isMobieNumber($search)) {
|
|
|
- $where['mobile'] = $search;
|
|
|
- } else {
|
|
|
- $where['userName'] = ['like', $search];
|
|
|
- }
|
|
|
- }
|
|
|
- $list = parent::actionList('*', $where);
|
|
|
- util::success($list);
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $status = isset($get['status']) ? $get['status'] : '';
|
|
|
+ $search = isset($get['search']) ? $get['search'] : '';
|
|
|
+ $where = [];
|
|
|
+ $where['merchantId'] = $this->merchantId;
|
|
|
+ if ($status != '') {
|
|
|
+ $where['status'] = $status;
|
|
|
+ }
|
|
|
+ if (!empty($search)) {
|
|
|
+ if (stringUtil::isMobieNumber($search)) {
|
|
|
+ $where['mobile'] = $search;
|
|
|
+ } else {
|
|
|
+ $where['userName'] = ['like', $search];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list = InviteService::getInviteList($where);
|
|
|
+ util::success($list);
|
|
|
}
|
|
|
|
|
|
//邀请有礼明细
|
|
|
- /*public function actionDetail()
|
|
|
+ public function actionDetail()
|
|
|
{
|
|
|
- //要验证只有商家自己的才能看,别人的不能看,如果不清楚留空,后面我会给你补验证
|
|
|
- //涉及用户和头像的从UserService调用,头像分原图和小图,不清楚留空或问我
|
|
|
- }*/
|
|
|
-
|
|
|
+ $id = Yii::$app->request->get('id');
|
|
|
+ $invite = InviteService::getById($id);
|
|
|
+ InviteService::valid($invite, $this->merchantId);
|
|
|
+ $detail = InviteService::getDetail($id);
|
|
|
+ util::success($detail);
|
|
|
+ }
|
|
|
+
|
|
|
//确认发奖
|
|
|
public function actionGive()
|
|
|
{
|
|
|
- //要验证只有商家自己的才能确认发放,别人的不能,如果不清楚留空,后面我会给你补验证
|
|
|
+ $id = Yii::$app->request->get('id');
|
|
|
+ $invite = InviteService::getById($id);
|
|
|
+ InviteService::valid($invite, $this->merchantId);
|
|
|
+ InviteService::give($invite);
|
|
|
+ util::ok();
|
|
|
}
|
|
|
|
|
|
//奖励设置详情
|
|
|
public function actionSet()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//奖励设置更新
|
|
|
public function actionSetUpdate()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|