Пример #1
0
 function saveopen()
 {
     if (empty($this->member['uid'])) {
         $link = IUrl::creatUrl('member/index');
         $this->message('想开店请先注册为普通会员', $link);
     }
     $maphone = IFilter::act(IReq::get('maphone'));
     $shopname = IFilter::act(IReq::get('shopname'));
     $address = IFilter::act(IReq::get('address'));
     $shoptype = IFilter::act(IReq::get('shoptype'));
     if (!IValidate::phone($maphone)) {
         $this->message('联系电话格式错误');
     }
     if (!IValidate::len($shopname, 3, 30)) {
         $this->message('店铺名长度大于3小于30');
     }
     if (!IValidate::len($address, 6, 50)) {
         $this->message('店铺地址长度大于6小于50');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where uid='" . $this->member['uid'] . "' ");
     if (!empty($userinfo)) {
         $this->message('您已绑定店铺不可操作');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where maphone='" . $maphone . "' ");
     if (!empty($userinfo)) {
         $this->message('联系人电话已存在');
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop where shopname='" . $shopname . "' ");
     if (!empty($userinfo)) {
         $this->message('店铺名称已重复');
     }
     $arr['shopname'] = $shopname;
     $arr['maphone'] = $maphone;
     $arr['uid'] = $this->member['uid'];
     $arr['address'] = $address;
     $arr['addtime'] = time();
     $arr['is_open'] = '0';
     $arr['shoptype'] = $shoptype;
     $nowday = 24 * 60 * 60 * 365;
     $data['endtime'] = time() + $nowday;
     $this->mysql->insert(Mysite::$app->config['tablepre'] . 'shop', $arr);
     $this->success('操作成功');
 }
Пример #2
0
 function editshop()
 {
     $backinfo = $this->checkapp();
     if (empty($backinfo['uid'])) {
         $this->message('nologin');
     }
     $typename = trim(IFilter::act(IReq::get('typename')));
     $typevalue = trim(IFilter::act(IReq::get('typevalue')));
     //   opentime
     if (!in_array($typename, array('opentype', 'opentime', 'shopphone'))) {
         $this->message('未定义的操作');
     }
     if ($typename == 'opentype') {
         $data['is_open'] = intval($typevalue);
     } elseif ($typename == 'opentime') {
         $bakcdata = str_replace(",", "|", $typevalue);
         $data['starttime'] = $bakcdata;
     } elseif ($typename == 'shopphone') {
         if (!IValidate::phone($typevalue)) {
             $this->message('正录入正确的订餐电话');
         }
         $data['phone'] = $typevalue;
     }
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'shop', $data, "uid='" . $backinfo['uid'] . "'");
     //shopphone
     //
     //获取店铺
     $this->success('ok');
 }
Пример #3
0
 function editaddress()
 {
     $this->checkmemberlogin();
     $what = trim(IFilter::act(IReq::get('what')));
     $addressid = intval(IReq::get('addressid'));
     if (empty($addressid)) {
         $this->message('编辑地址获取失败');
     }
     if ($what == 'default') {
         $arr['default'] = 0;
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "userid='" . $this->member['uid'] . "'");
         $arr['default'] = 1;
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'addr') {
         $arr['address'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::len($arr['address'], 5, 50)) {
             $this->message('录入地址长度不能少于5个');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'phone') {
         $arr['phone'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::phone($arr['phone'])) {
             $this->message('录入的联系电话不是手机或者座机正确');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'bak_phone') {
         $arr['otherphone'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::phone($arr['otherphone'])) {
             $this->message('录入的备用电话不是手机或者座机正确');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } elseif ($what == 'recieve_name') {
         $arr['contactname'] = IFilter::act(IReq::get('controlname'));
         if (!IValidate::len($arr['contactname'], 2, 6)) {
             $this->message('联系人名长度不能小于2个大于6个');
         }
         $this->mysql->update(Mysite::$app->config['tablepre'] . 'address', $arr, "id='" . $addressid . "' and userid='" . $this->member['uid'] . "' ");
         $this->success('操作成功');
     } else {
         $this->message('未定义的操作');
     }
 }
Пример #4
0
 public function savemember()
 {
     $this->checkadminlogin();
     $uid = intval(IReq::get('uid'));
     $data['username'] = IReq::get('username');
     $data['password'] = IReq::get('password');
     $data['phone'] = IReq::get('phone');
     $data['address'] = IReq::get('address');
     $data['email'] = IReq::get('email');
     $data['group'] = IReq::get('group');
     $data['score'] = IReq::get('score');
     $data['cost'] = IReq::get('cost');
     if (!IValidate::email($data['email'])) {
         $this->message('邮箱格式错误! [好资源www.mx800.com]');
     }
     if (!IValidate::phone($data['phone'])) {
         $this->message('联系电话格式错误! [好资源www.mx800.com]');
     }
     if (empty($data['username'])) {
         $this->message('用户名不能为空 [好资源www.mx800.com]');
     }
     if (empty($uid)) {
         if ($this->memberCls->regester($data['email'], $data['username'], $data['password'], $data['phone'], $data['group'], '', '', $data['cost'], $data['score'])) {
             $this->success('操作成功!');
         } else {
             $this->message($this->memberCls->ero());
         }
     } else {
         if ($this->memberCls->modify($data, $uid)) {
             $this->success('操作成功!');
         } else {
             $this->message($this->memberCls->ero());
         }
     }
     $this->success('操作成功!');
 }