728 lines
24 KiB
PHP
728 lines
24 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2021-4-17
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
|
||
namespace app\modules\api\controllers;
|
||
|
||
use function AlibabaCloud\Client\value;
|
||
use app\components\EncryptHelper;
|
||
use app\models\Order;
|
||
use app\models\OrderDetail;
|
||
use app\models\QrcodeRecord;
|
||
use app\models\StoreUser;
|
||
use app\models\User;
|
||
use app\models\UserInformation;
|
||
use app\modules\api\behaviors\LoginBehavior;
|
||
use app\modules\api\models\CommentForm;
|
||
use app\modules\api\models\UserBasicInfoForm;
|
||
use app\modules\api\models\UserCollectForm;
|
||
use app\modules\api\models\UserModifyForm;
|
||
|
||
class UserController extends Controller
|
||
{
|
||
public function behaviors()
|
||
{
|
||
return array_merge(parent::behaviors(), [
|
||
'login' => [
|
||
'class' => LoginBehavior::className(),
|
||
'ignore' => [
|
||
'api/user/add-qrcode-find',
|
||
'api/user/find',
|
||
|
||
// 'api/user/user-collect-list',
|
||
'api/user/user-collect-hot',
|
||
// 'api/user/user-collect',
|
||
// 'api/user/user-collect-del',
|
||
]
|
||
]
|
||
]);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 基础信息
|
||
* @description 获取个人基础信息
|
||
* @method get
|
||
* @url /api/user/index
|
||
* @return {"code":0,"msg":"ok","data":{"user_id":"1","nickname":"admin","avatar_url":"http://app.tpl.dev.1nww.com/statics/images/avatar.jpg","gender":0,"gender_cn":"未知","is_modify_un":false,"type_cn":"管理员","is_admin":true}}
|
||
* @return_param is_modify_un boolean 是否可以修改用户名
|
||
* @return_param is_admin boolean 是否为管理员
|
||
* @return_param is_view int 是否已观看视频,0未观看,1已观看
|
||
* @return_param is_logout int 是否可提交注销,0可以提交,1可以撤销
|
||
* @return_param account_balance string 账户余额
|
||
* @return_param account_balance_with string 可提现余额
|
||
* @return_param account_balance_freeze string 冻结金额
|
||
* @return_param account_integral string 账户积分,整数
|
||
* @return_param account_integral_floor string 账户积分,浮点型
|
||
* @return_param level.cover string 背景卡片
|
||
* @return_param level.desc string 介绍
|
||
* @return_param level.level_exp string 经验值
|
||
* @return_param level.recharge_number string 所需升级经验
|
||
* @return_param level.level_id string 会员等级,0普通用户1见习会员2进阶会员3高阶会员
|
||
* @remark
|
||
*/
|
||
public function actionIndex()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$form->pid = \Yii::$app->request->get('pid', 0);
|
||
$data = $form->search();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 基础信息
|
||
* @description 获取个人基础信息
|
||
* @method get
|
||
* @url /api/user/index
|
||
* @return {"code":0,"msg":"ok","data":{"user_id":"1","nickname":"admin","avatar_url":"http://app.tpl.dev.1nww.com/statics/images/avatar.jpg","gender":0,"gender_cn":"未知","is_modify_un":false,"type_cn":"管理员","is_admin":true}}
|
||
* @return_param is_modify_un boolean 是否可以修改用户名
|
||
* @return_param is_admin boolean 是否为管理员
|
||
* @return_param is_view int 是否已观看视频,0未观看,1已观看
|
||
* @return_param is_logout int 是否可提交注销,0可以提交,1可以撤销
|
||
* @return_param account_balance string 账户余额
|
||
* @return_param account_balance_with string 可提现余额
|
||
* @return_param account_balance_freeze string 冻结金额
|
||
* @return_param account_integral string 账户积分,整数
|
||
* @return_param account_integral_floor string 账户积分,浮点型
|
||
* @return_param level.cover string 背景卡片
|
||
* @return_param level.desc string 介绍
|
||
* @return_param level.level_exp string 经验值
|
||
* @return_param level.recharge_number string 所需升级经验
|
||
* @return_param level.level_id string 会员等级,0普通用户1见习会员2进阶会员3高阶会员
|
||
* @remark
|
||
*/
|
||
public function actionFind()
|
||
{
|
||
$user_id = \Yii::$app->user->identity->id;
|
||
$data = [
|
||
'code' => 0,
|
||
'msg' => 'ok',
|
||
'data' => true
|
||
];
|
||
if ($user_id == null) {
|
||
$data['data'] = false;
|
||
}
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 修改头像
|
||
* @description 修改用户头像
|
||
* @method post
|
||
* @url /api/user/modify-avatar
|
||
* @param avatar_url 必选 string 头像地址,文件上传接口返回地址
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyAvatar()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
// $form->scenario = 'avatar';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->modify_avatar();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 修改昵称
|
||
* @description 修改用户昵称
|
||
* @method post
|
||
* @url /api/user/modify-nickname
|
||
* @param nickname 必选 string 昵称
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyNickname()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
// $form->scenario = 'nickname';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->modify_nickname();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 修改性别
|
||
* @description 修改用户性别
|
||
* @method post
|
||
* @url /api/user/modify-gender
|
||
* @param gender 必选 int 性别,0=未知,1=男,2=女,3=保密
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyGender()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->scenario = 'gender';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->modify_gender();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 修改所在城市
|
||
* @description 修改用户所在城市
|
||
* @method post
|
||
* @url /api/user/modify-city
|
||
* @param city_id 必选 int 城市ID
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyCity()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->scenario = 'city';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->modify_city();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 会员注册
|
||
* @method post
|
||
* @url /api/user/modify-user
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyUser()
|
||
{
|
||
$post = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value
|
||
$form = new UserModifyForm();
|
||
$form->setScenario('modify_user');
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->price = $post['price'];
|
||
unset($post['price']);
|
||
$form->attributes = $post;
|
||
$form->user_id = \Yii::$app->user->identity->id; //获取用户登陆ID
|
||
$data = $form->modify_user();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @return array
|
||
*/
|
||
public function actionModifyUserBuy()
|
||
{
|
||
$form = new UserModifyForm();
|
||
$form->setScenario('modify_user_buy');
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->attributes = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value
|
||
$form->user_id = \Yii::$app->user->identity->id; //获取用户登陆ID
|
||
$data = $form->modify_user_buy();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 会员注册判断
|
||
* @method post
|
||
* @url /api/user/user-list
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionUserFind()
|
||
{
|
||
$form = new UserModifyForm();
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
|
||
$data = $form->verifyUserInfo();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
*hidedoc
|
||
*/
|
||
public function actionUserPersonal()
|
||
{
|
||
$form = new UserModifyForm();
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$request = \Yii::$app->request;
|
||
if ($request->isPost) {
|
||
$form->setScenario('user_personal');
|
||
$form->attributes = $request->post(); // attributes 转成键值对形式 key=> value;
|
||
}
|
||
$data = $form->userPersonal($request);
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @return array
|
||
*/
|
||
public function actionEvaluate()
|
||
{
|
||
$form = new CommentForm();
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$form->attributes = \Yii::$app->request->post(); // attributes 转成键值对形式 key=> value
|
||
$data = $form->evaluation();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
*/
|
||
public function actionEvaluateShow()
|
||
{
|
||
$form = new CommentForm();
|
||
$form->cx_mch_id = $this->cx_mch_id; //商户ID 没看到传参赋值 默认给0
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$form->attributes = \Yii::$app->request->get(); // attributes 转成键值对形式 key=> value
|
||
$data = $form->evaluationList();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 获取用户id的事件
|
||
* @description 修改用户所在城市
|
||
* @method get
|
||
* @param user_id int 用户id
|
||
* @url /api/user/get-user-id-event
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionGetUserIdEvent()
|
||
{
|
||
$id = \Yii::$app->request->get('user_id');
|
||
if (empty($id)) {
|
||
return $this->responseHandler(['code' => 1, 'msg' => 'ok', 'data' => []]);
|
||
}
|
||
$key = "api:user_event_data:{$id}";
|
||
$get = \Yii::$app->redis->hkeys($key);
|
||
if (empty($get)) {
|
||
\Yii::$app->redis->hset($key, "temp_field", 1);
|
||
return $this->responseHandler(['code' => 1, 'msg' => 'ok', 'data' => []]);
|
||
}
|
||
$event_id = '';
|
||
foreach ($get as $k => $v) {
|
||
if ($v == 'temp_field') {
|
||
continue;
|
||
}
|
||
$event_id = $v;
|
||
break;
|
||
}
|
||
if (empty($event_id)) {
|
||
return $this->responseHandler(['code' => 1, 'msg' => 'ok', 'data' => []]);
|
||
}
|
||
return $this->responseHandler(['code' => 0, 'msg' => 'ok', 'data' => ['event_id' => $event_id]]);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 停止用户id的事件
|
||
* @description 修改用户所在城市
|
||
* @method get
|
||
* @param user_id int 用户id
|
||
* @param event_id string 事件id
|
||
* @url /api/user/end-user-id-event
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionEndUserIdEvent()
|
||
{
|
||
$id = \Yii::$app->request->get('user_id');
|
||
$event_id = \Yii::$app->request->get('event_id');
|
||
if (empty($id) || empty($event_id)) {
|
||
return $this->responseHandler(['code' => 1, 'msg' => 'ok', 'data' => []]);
|
||
}
|
||
$key = "api:user_event_data:{$id}";
|
||
\Yii::$app->redis->hdel($key, $event_id);
|
||
return $this->responseHandler(['code' => 0, 'msg' => 'ok', 'data' => []]);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 呼叫服务员
|
||
* @title 呼叫服务员
|
||
* @description 呼叫服务员
|
||
* @method post
|
||
* @url /api/user/service-person
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @return_param data array 手机号,一维索引数组
|
||
* @remark
|
||
*/
|
||
public function actionServicePerson()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$user_id = \Yii::$app->user->identity->id;
|
||
$order = Order::find()->where(['is_delete' => 0, 'status' => [1, 2], 'user_id' => $user_id])->orderBy(['id' => SORT_DESC])->one();
|
||
if (empty($order) || empty($order->store_id)) {
|
||
return $this->responseHandler(['code' => 1, 'msg' => '没有正在进行中的订单,无法呼叫']);
|
||
}
|
||
|
||
$store_id = $order->store_id;
|
||
|
||
$phone = [];
|
||
$user_ids = StoreUser::find()->where(['is_delete' => 0, 'store_id' => $store_id, 'user_type' => 2, 'status' => 0])->select('user_id')->column();
|
||
|
||
if (!empty($user_ids)) {
|
||
$mobile_phone = User::find()->where(['id' => $user_ids])->select('mobile_phone')->column();
|
||
if (!empty($mobile_phone)) {
|
||
foreach ($mobile_phone as &$item) {
|
||
$item = EncryptHelper::decryptMobilePhone($item);
|
||
}
|
||
$phone = $mobile_phone;
|
||
}
|
||
}
|
||
if (empty($phone)) {
|
||
return $this->responseHandler(['code' => 1, 'msg' => '订单所在门店未绑定服务人员,无法呼叫']);
|
||
}
|
||
return $this->responseHandler(['code' => 0, 'msg' => 'ok', 'data' => $phone]);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 二维码访问
|
||
* @title 二维码访问
|
||
* @description 二维码访问
|
||
* @method post
|
||
* @url /api/user/add-qrcode-find
|
||
* @param store_id int 门店id
|
||
* @param ball_id string 球车编号
|
||
* @return
|
||
* @return_param
|
||
* @remark
|
||
*/
|
||
public function actionAddQrcodeFind()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$user_id = 0;
|
||
if (!empty(\Yii::$app->user->identity)) {
|
||
$user_id = \Yii::$app->user->identity->id ? \Yii::$app->user->identity->id : 0;
|
||
}
|
||
$store_id = \Yii::$app->request->post('store_id');
|
||
$ball_id = \Yii::$app->request->post('ball_id');
|
||
if (!empty($ball_id)) {
|
||
$unionid = $ball_id;
|
||
$type = 2;
|
||
} else {
|
||
$unionid = $store_id;
|
||
$type = 1;
|
||
}
|
||
$value = ['user_id' => $user_id, 'store_id' => $store_id, 'ball_id' => $ball_id];
|
||
$value = json_encode($value);
|
||
$obj = new QrcodeRecord();
|
||
$obj->unionid = $unionid;
|
||
$obj->data = $value;
|
||
$obj->type = $type;
|
||
$obj->created_at = time();
|
||
$obj->is_delete = 0;
|
||
$obj->deleted_at = 0;
|
||
$obj->save();
|
||
/*$time = time();
|
||
$date = date('Y-m-d');
|
||
$h = date('H');
|
||
if(!empty($store_id)){
|
||
$key = 'api:cxaibc:qrcode:store_id:'.$store_id.":date_{$date}:h_{$h}";
|
||
}
|
||
if(!empty($ball_id)){
|
||
$key = 'api:cxaibc:qrcode:ball_id:'.$ball_id.":date_{$date}:h_{$h}";
|
||
}
|
||
\Yii::$app->redis->rpush($key,$value);
|
||
$redis_name = "api:cxaibc:qrcode:date:list";
|
||
\Yii::$app->redis->lpush($redis_name,$date);*/
|
||
return $this->responseHandler([
|
||
'code' => 0,
|
||
'msg' => 'ok',
|
||
'data' => ''
|
||
]);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息
|
||
* @title 用户首次下单时看完视频调用
|
||
* @description 用户首次下单时看完视频调用
|
||
* @method post
|
||
* @url /api/user/find-video
|
||
* @return
|
||
* @return_param
|
||
* @remark 注:可根据/api/user/index【用户/基础信息】接口获取到用户观看状态
|
||
*/
|
||
public function actionFindVideo()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->find_video();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 注销申请
|
||
* @description 注销申请
|
||
* @method post
|
||
* @url /api/user/account-logout
|
||
* @return
|
||
* @return_param
|
||
* @remark
|
||
*/
|
||
public function actionAccountLogout()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->account_logout();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 撤销注销申请
|
||
* @description 撤销注销申请
|
||
* @method post
|
||
* @url /api/user/account-logout-revocation
|
||
* @return
|
||
* @return_param
|
||
* @remark
|
||
*/
|
||
public function actionAccountLogoutRevocation()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->account_logout_revocation();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 编辑个人资料
|
||
* @description 编辑个人资料
|
||
* @method post
|
||
* @url /api/user/modify-info
|
||
* @param avatar_url 必选 string 头像
|
||
* @param nickname 非必选 string 昵称
|
||
* @param mobile_phone 非必选 string 手机号
|
||
* @param gender 必选 int 性别,0=未知,1=男,2=女,3=保密
|
||
* @param birthday 必选 string 生日
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionModifyInfo()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->scenario = 'info';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->modify_info();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 充值弹框提醒
|
||
* @description 支付时请求该接口
|
||
* @method get
|
||
* @url /api/user/recharge-remind-minute
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @return_param level_data array 等级介绍
|
||
* @return_param levelDetails string 规则介绍
|
||
* @remark code=1为接口异常,data不为空时可弹框
|
||
*/
|
||
public function actionRechargeRemindMinute()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->scenario = 'recharge_remind_minute';
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->recharge_remind_minute();
|
||
return $this->responseHandler($data);
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 获取分销列表
|
||
* @description 获取分销列表
|
||
* @method get
|
||
* @url /api/user/user-next-list
|
||
* @param page int 页码
|
||
* @param limit int 页数
|
||
* @return_param nickname string 昵称
|
||
* @return_param avatar_url string 头像
|
||
* @return_param mobile_phone string 手机号
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
*/
|
||
public function actionUserNextList()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$page = \Yii::$app->request->get('page', 1);
|
||
$limit = \Yii::$app->request->get('limit', 10);
|
||
$data = $form->actionUserNextList($page, $limit);
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户信息
|
||
* @title 获取分享海报图片及二维码
|
||
* @description 获取分销列表
|
||
* @method get
|
||
* @url /api/user/get-distribution
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @return_param distributionPoster array 海报素材
|
||
* @return_param qrcode_path string 小程序二维码
|
||
* @return_param mobile_phone string 手机号
|
||
* @return_param address string 门店地址
|
||
* @return_param site_name string 站点名称
|
||
*/
|
||
public function actionGetDistribution()
|
||
{
|
||
$form = new UserBasicInfoForm();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->getDistribution();
|
||
return $this->responseHandler($data);
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户收藏列表
|
||
* @title 用户收藏列表
|
||
* @description 用户收藏列表
|
||
* @method get
|
||
* @url /api/user/user-collect-list
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
*/
|
||
public function actionUserCollectList()
|
||
{
|
||
$form = new UserCollectForm();
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
// $form->user_id = 124;
|
||
$data = $form->search();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 热门收藏冠军
|
||
* @title 热门收藏冠军
|
||
* @description 热门收藏冠军
|
||
* @method get
|
||
* @url /api/user/user-collect-hot
|
||
* @return {"code":0,"msg":"ok","data":[{"goods_id":"2","cover_pic":"http://cxgj.com/upload/0/1/upload/image/2023/1127/1701077471438838.jpg"},{"goods_id":"1","cover_pic":"http://cxgj.com/upload/0/1/upload/image/2023/1127/1701072071337970.jpg"}],"count":"2"}
|
||
*/
|
||
public function actionUserCollectHot()
|
||
{
|
||
$form = new UserCollectForm();
|
||
$data = $form->hot();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户收藏
|
||
* @title 用户收藏
|
||
* @description 用户收藏
|
||
* @method get
|
||
* @url /api/user/user-collect
|
||
* @return {"code":0,"msg":"收藏成功","data":{}}
|
||
*/
|
||
public function actionUserCollect()
|
||
{
|
||
$form = new UserCollectForm();
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$goods_id = \Yii::$app->request->post('goods_id');
|
||
|
||
// $form->user_id = 124;
|
||
$form->goods_id = $goods_id;
|
||
|
||
$data = $form->collect();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 用户取消收藏
|
||
* @title 用户取消收藏
|
||
* @description 用户取消收藏
|
||
* @method get
|
||
* @url /api/user/user-collect
|
||
* @param id 必选 string 对应收藏列表的ID
|
||
* @return {"code":0,"msg":"取消收藏成功","data":{}}
|
||
*/
|
||
public function actionUserCollectDel()
|
||
{
|
||
$form = new UserCollectForm();
|
||
$id = \Yii::$app->request->post('id');
|
||
|
||
// $form->user_id = 124;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$form->id = $id;
|
||
$data = $form->del();
|
||
return $this->responseHandler($data);
|
||
}
|
||
} |