用户相关
This commit is contained in:
parent
825f29a09a
commit
344d420e99
@ -35,4 +35,11 @@ class UserController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function info()
|
||||||
|
{
|
||||||
|
return $this->success('success', UserLogic::info($this->userId));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -112,13 +112,21 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
$where[]=['store_id','=',$store_id];
|
$where[]=['store_id','=',$store_id];
|
||||||
return StoreBranchProduct::where($this->searchWhere)->where($where)
|
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||||
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->with(['className','unitName'])
|
->with(['className','unitName'])
|
||||||
->order($order)
|
->order($order)
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
foreach ($data as &$value){
|
||||||
|
$value['is_default'] = 0;
|
||||||
|
if($store_id == 2){
|
||||||
|
$value['is_default'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
|
||||||
// return StoreProduct::where($this->searchWhere)->where($where)
|
// return StoreProduct::where($this->searchWhere)->where($where)
|
||||||
// ->field(['id', 'cate_id','store_name','unit', 'ot_price', 'bar_code','image','sales','store_info'])
|
// ->field(['id', 'cate_id','store_name','unit', 'ot_price', 'bar_code','image','sales','store_info'])
|
||||||
|
@ -7,6 +7,8 @@ use app\admin\lists\BaseAdminDataLists;
|
|||||||
use app\common\enum\YesNoEnum;
|
use app\common\enum\YesNoEnum;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\MyBusinessException;
|
||||||
|
use think\Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,15 +46,29 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
|
$latitude = $this->request->get('latitude','');
|
||||||
|
$longitude = $this->request->get('longitude','');
|
||||||
|
if(empty($longitude) || empty($latitude)){
|
||||||
|
throw new MyBusinessException('缺失经纬度');
|
||||||
|
}
|
||||||
$where[]=['is_show','=',YesNoEnum::YES];
|
$where[]=['is_show','=',YesNoEnum::YES];
|
||||||
return SystemStore::where($this->searchWhere)->where($where)
|
$data = SystemStore::where($this->searchWhere)->where($where)
|
||||||
->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_time','is_store','latitude','longitude','day_start','day_end','is_store'
|
||||||
|
,'is_send'
|
||||||
])
|
])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
foreach ($data as &$value){
|
||||||
|
$value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude);
|
||||||
|
}
|
||||||
|
usort($data, function ($a, $b) {
|
||||||
|
return $a['distance'] <=> $b['distance'];
|
||||||
|
});
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,10 +3,7 @@
|
|||||||
namespace app\api\logic\user;
|
namespace app\api\logic\user;
|
||||||
|
|
||||||
|
|
||||||
use app\common\{
|
use app\common\{logic\BaseLogic, model\system_store\SystemStore, model\user\User, service\wechat\WeChatMnpService};
|
||||||
logic\BaseLogic,
|
|
||||||
model\user\User,
|
|
||||||
service\wechat\WeChatMnpService};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员逻辑层
|
* 会员逻辑层
|
||||||
@ -56,4 +53,29 @@ class UserLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function info($uid)
|
||||||
|
{
|
||||||
|
$data = User::where('id',$uid)
|
||||||
|
->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money')
|
||||||
|
->find();
|
||||||
|
|
||||||
|
//判断是不是员工
|
||||||
|
if($data){
|
||||||
|
$data = $data->toArray();
|
||||||
|
$data['is_staff'] = 0;
|
||||||
|
$data['store_id'] = 0;
|
||||||
|
if(isset($data['mobile']) && $data['mobile']){
|
||||||
|
$check = SystemStore::where('phone',$data['mobile'])->find()??[];
|
||||||
|
if ($check){
|
||||||
|
$data['is_staff'] = 1;
|
||||||
|
$data['store_id'] = $check['store_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$data = [];
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user