1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace app\admin\controller;
- use app\BaseController;
- use think\App;
- use think\facade\Db;
- class WareHouse extends BaseController
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $post =$this->request->post();
- $token = isset($post['token']) ? trim($post['token']) : "";
- // if($token==""){
- // return error_show(101,'token不能为空');
- //
- // }
- // $effetc = VerifyTokens($token);
- // if(!empty($effetc) && $effetc['code']!=0){
- // return error_show($effetc['code'],$effetc['message']);
- //
- // }
- }
- public function add(){
- $post =$this->request->post();
- $name = isset($post['name'])&& $post['name']!='' ?trim($post['name']) :'';
- if($name==''){
- return error_show(1004,'参数name 不能为空');
- }
- $supplier = isset($post['supplierid'])&& $post['supplierid']!='' ?intval($post['supplierid']) :'';
- if($supplier==''){
- return error_show(1004,'参数supplierid 不能为空');
- }
- $wsmtype = isset($post['wsmtype'])&& $post['wsmtype']!='' ?intval($post['wsmtype']) :'';
- if($wsmtype==''){
- return error_show(1004,'参数wsmtype 不能为空');
- }
- $isT = Db::name('warehouse_info')->where([['name',"=",$name]])->find();
- if(!empty($isT)){
- return error_show(1004,'仓库名称已存在');
- }
- $addr = isset($post['addr'])&& $post['addr']!='' ?trim($post['addr']) :'';
- if($addr==''){
- return error_show(1004,'参数addr 不能为空');
- }
- $contactor = isset($post['contactor'])&& $post['contactor']!='' ?trim($post['contactor']) :'';
- if($contactor==''){
- return error_show(1004,'参数contactor 不能为空');
- }
- $mobile = isset($post['mobile'])&& $post['mobile']!='' ?trim($post['mobile']) :'';
- if($mobile==''){
- return error_show(1004,'参数mobile 不能为空');
- }
- $position = isset($post['position'])&& $post['position']!='' ?trim($post['position']) :'';
- $data =[
- 'wsm_code'=>makeNo("WSM"),
- 'name'=>$name,
- 'wsm_type'=>$wsmtype,
- 'supplierid'=>$supplier,
- 'addr'=>$addr,
- 'contactor'=>$contactor,
- 'mobile'=>$mobile,
- 'position'=>$position,
- 'status'=>1,
- 'addtime'=>date("Y-m-d H:i:s"),
- 'updatetime'=>date("Y-m-d H:i:s")
- ];
- $add = Db::name('warehouse_info')->insert($data);
- return $add ? app_show(0,'仓库创建成功'): error_show(1005,'仓库创建失败');
- }
- public function list(){
- $post =$this->request->post();
- $supplier = isset($post['supplierid'])&& $post['supplierid']!='' ?intval($post['supplierid']) :'';
- if($supplier==''){
- return error_show(1004,'参数supplierid 不能为空');
- }
- }
- }
|