汪总电商平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
3.0 KiB

<?php
namespace app\api\controller\wanlshop;
use app\common\controller\Api;
use fast\Tree;
/**
* WanlShop店铺接口
*/
class Store extends Api
{
protected $noNeedLogin = '';
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize();
$this->model = model('app\admin\model\wanlshop\Store');
}
public function setstoreinfo(){
if($this->request->isPost()){
$data = $this->request->post();
$uid = $this->auth->id;
if(!$uid) $this->error("请先登录");
$info = $this->model->where("uid",$uid)->find();
$insert['store_name'] = isset($data['store_name'])?$data['store_name']:'';
$insert['store_zhizhao'] = isset($data['store_zhizhao'])?$data['store_zhizhao']:'';
$insert['cardno'] = isset($data['cardno'])?$data['cardno']:'';
$insert['card_zheng'] = isset($data['card_zheng'])?$data['card_zheng']:'';
$insert['card_fan'] = isset($data['card_fan'])?$data['card_fan']:'';
$insert['card_people'] = isset($data['card_people'])?$data['card_people']:'';
$insert['door_people'] = isset($data['door_people'])?$data['door_people']:'';
$insert['back_name'] = isset($data['back_name'])?$data['back_name']:'';
$insert['back_card'] = isset($data['back_card'])?$data['back_card']:'';
$insert['type'] = isset($data['type'])?$data['type']:'';
$insert['createtime'] = date("Y-m-d H:i:s",time());
$insert['status'] = 0;
$insert['working_time'] = isset($data['working_time'])?$data['working_time']:'';
$insert['uid'] = $uid;
if(isset($data['id'])&&$data['id']){
$insert['id'] = $data['id'];
$res = $this->model->update($insert);
}else{
if(!empty($info))$this->success("资料正在审核中请勿重复提交");
$res = $this->model->insert($insert);
}
if($res) $this->success("已提交,待管理员审核");
$this->error("提交失败");
}
}
public function getstoreinfo(){
if($this->request->isPost()){
$uid = $this->auth->id;
if(!$uid) $this->error("请先登录");
$info = $this->model->where("uid",$uid)->find();
$info = empty($info)?'':$info;
return $this->success("获取成功",$info);
}
}
public function getstorelist(){
//设置过滤方法
$data = $this->request->post();
$page = $data['page'];
$where = [];
if(isset($data['keywords']) && $data['keywords']){
$where['store_name'] = ['like',"%{$data['keywords']}%"];
}
// 查询数据
$list = $this->model
->where($where)
->where('status', '1')
->paginate(['page'=> $page?? 1,'list_rows' => 10]);
return $this->success("获取店铺列表成功",$list);
}
}