Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
008e69f35a
@ -51,7 +51,7 @@ class StoreController extends BaseApiController
|
|||||||
|
|
||||||
$info = StoreLogic::search($where);
|
$info = StoreLogic::search($where);
|
||||||
if ($info) {
|
if ($info) {
|
||||||
return $this->success('ok',$info??[]);
|
return $this->success('ok',$info);
|
||||||
} else {
|
} else {
|
||||||
return $this->fail('店铺不存在');
|
return $this->fail('店铺不存在');
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ class UserController extends BaseApiController
|
|||||||
return $this->fail('发送失败');
|
return $this->fail('发送失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//登录
|
||||||
public function login_sms()
|
public function login_sms()
|
||||||
{
|
{
|
||||||
$params = (new UserValidate())->post()->goCheck('login');
|
$params = (new UserValidate())->post()->goCheck('login');
|
||||||
@ -158,6 +159,18 @@ class UserController extends BaseApiController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//报备
|
||||||
|
public function reporting_sms()
|
||||||
|
{
|
||||||
|
$params = (new UserValidate())->post()->goCheck('login');
|
||||||
|
$res = (new UserLogic())->dealReportingSms($params['account']);
|
||||||
|
if ($res){
|
||||||
|
return $this->success('发送成功');
|
||||||
|
}
|
||||||
|
return $this->fail('发送失败');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function set_payPassword()
|
public function set_payPassword()
|
||||||
|
@ -12,15 +12,13 @@ class StoreLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function search($param)
|
public static function search($param)
|
||||||
{
|
{
|
||||||
return SystemStore::where($param)
|
$data = SystemStore::where($param)
|
||||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show',
|
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show',
|
||||||
'day_time', 'is_store', 'latitude', 'longitude', 'day_start', 'day_end', 'is_store'
|
'day_time', 'is_store', 'latitude', 'longitude', 'day_start', 'day_end', 'is_store'
|
||||||
, 'is_send'
|
, 'is_send'
|
||||||
])
|
])
|
||||||
->find()
|
->find();
|
||||||
->toArray();
|
return $data ? $data->toArray() : [];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,14 +59,15 @@ class AddressLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
if($params['is_default']==1){
|
$is_default = $params['is_default'] ??0;
|
||||||
|
if($is_default==1){
|
||||||
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'real_name' => $params['real_name'],
|
'real_name' => $params['real_name'],
|
||||||
'phone' => $params['phone'],
|
'phone' => $params['phone'],
|
||||||
'detail' => $params['detail'],
|
'detail' => $params['detail']??'',
|
||||||
'is_default' => $params['is_default'],
|
'is_default' => $params['is_default']??0,
|
||||||
'province' => $params['province'],
|
'province' => $params['province'],
|
||||||
'city' => $params['city'],
|
'city' => $params['city'],
|
||||||
'area' => $params['area'],
|
'area' => $params['area'],
|
||||||
@ -109,4 +110,10 @@ class AddressLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray();
|
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function info($params): array
|
||||||
|
{
|
||||||
|
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where($params)->findOrEmpty()->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,6 +211,22 @@ class UserLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function dealReportingSms($phone)
|
||||||
|
{
|
||||||
|
$code = generateRandomCode();
|
||||||
|
$template = getenv('SMS_LOGIN_TEMPLATE');
|
||||||
|
$check =(new SmsService())->client($phone,$template,$code);
|
||||||
|
if($check){
|
||||||
|
$remark = $phone.'_reporting';
|
||||||
|
Cache::set($remark,$code,5*60);
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function dealPayPassword($params,$uid)
|
public static function dealPayPassword($params,$uid)
|
||||||
|
@ -44,6 +44,6 @@ class AddressController extends BaseAdminController
|
|||||||
if($uid){
|
if($uid){
|
||||||
$params = ['uid' => $uid];
|
$params = ['uid' => $uid];
|
||||||
}
|
}
|
||||||
return $this->success('获取成功',AddressLogic::detail($params));
|
return $this->success('获取成功',AddressLogic::info($params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user