92 lines
2.7 KiB
PHP
92 lines
2.7 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\store\controller\user;
|
|
|
|
|
|
use app\common\service\SmsService;
|
|
use app\store\controller\BaseAdminController;
|
|
use app\store\lists\user\UserLists;
|
|
use app\admin\logic\user\UserLogic;
|
|
use app\admin\validate\user\UserValidate;
|
|
use app\api\controller\user\UserRechargeController;
|
|
use app\common\model\user\User;
|
|
use support\Cache;
|
|
|
|
class UserController extends BaseAdminController
|
|
{
|
|
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new UserLists());
|
|
}
|
|
|
|
/**
|
|
* 用户档案短信
|
|
* @return \support\Response
|
|
*/
|
|
public function archives_sms()
|
|
{
|
|
$mobile = $this->request->post('mobile', '');
|
|
if (empty($mobile))
|
|
return $this->fail('手机号缺失');
|
|
$res = (new \app\api\logic\user\UserLogic())->dealReportingSms($mobile, '_userArchives');
|
|
if ($res) {
|
|
return $this->success('发送成功');
|
|
}
|
|
return $this->fail('发送失败');
|
|
}
|
|
public function add()
|
|
{
|
|
$params = (new UserValidate())->post()->goCheck('storeAdd');
|
|
$code = $params['code'];
|
|
// if($code && $params['mobile']){
|
|
// $remark = $params['mobile'].'_userArchives';
|
|
// $codeCache = Cache::get($remark);
|
|
// if(empty($codeCache)){
|
|
// return $this->fail('验证码不存在');
|
|
// }
|
|
// if ($codeCache != $code) {
|
|
// return $this->fail('验证码错误');
|
|
// }
|
|
// }
|
|
UserLogic::StoreAdd($params);
|
|
if (UserLogic::hasError()) {
|
|
return $this->fail(UserLogic::getError());
|
|
}
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
|
|
public function detail()
|
|
{
|
|
$params = (new UserValidate())->goCheck('detail');
|
|
$detail = UserLogic::detail($params['id']);
|
|
return $this->success('', $detail);
|
|
}
|
|
|
|
public function user_ship()
|
|
{
|
|
$user_ship = $this->request->post('user_ship', 0);
|
|
$id = $this->request->post('id', 0);
|
|
if ($user_ship == 1) {
|
|
return $this->fail('充值会员不能前端设置');
|
|
}
|
|
User::where('id', $id)->update(['user_ship' => $user_ship]);
|
|
return $this->success('设置成功');
|
|
}
|
|
|
|
public function user_label()
|
|
{
|
|
$label_id = $this->request->post('label_id', 0);
|
|
$id = $this->request->post('id', 0);
|
|
|
|
User::where('id', $id)->update(['label_id' => $label_id]);
|
|
return $this->success('设置成功');
|
|
}
|
|
|
|
public function recharge_list()
|
|
{
|
|
return (new UserRechargeController())->recharge_list();
|
|
}
|
|
}
|