作者 王晓刚
1 个管道 的构建 通过 耗费 23 秒

合并分支 'wxg' 到 'master'

后无车页面优化



查看合并请求 !64
@@ -5,6 +5,7 @@ namespace app\admin\controller\general; @@ -5,6 +5,7 @@ namespace app\admin\controller\general;
5 use app\admin\model\Admin; 5 use app\admin\model\Admin;
6 use app\common\controller\Backend; 6 use app\common\controller\Backend;
7 use fast\Random; 7 use fast\Random;
  8 +use think\Db;
8 use think\Session; 9 use think\Session;
9 use think\Validate; 10 use think\Validate;
10 11
@@ -44,6 +45,8 @@ class Profile extends Backend @@ -44,6 +45,8 @@ class Profile extends Backend
44 45
45 return json($result); 46 return json($result);
46 } 47 }
  48 + $row = Db::name('store')->where(['admin_id'=>$this->auth->id])->find();
  49 + $this->assign('row',$row);
47 return $this->view->fetch(); 50 return $this->view->fetch();
48 } 51 }
49 52
@@ -55,14 +58,21 @@ class Profile extends Backend @@ -55,14 +58,21 @@ class Profile extends Backend
55 if ($this->request->isPost()) { 58 if ($this->request->isPost()) {
56 $this->token(); 59 $this->token();
57 $params = $this->request->post("row/a"); 60 $params = $this->request->post("row/a");
  61 + $money = $params['money'];
  62 + $freight = $params['freight'];
  63 + $phone = $params['phone'];
  64 + $address = $params['address'];
  65 + $lng = $params['lng'];
  66 + $lat = $params['lat'];
  67 + $content = $params['content'];
58 $params = array_filter(array_intersect_key( 68 $params = array_filter(array_intersect_key(
59 $params, 69 $params,
60 array_flip(array('email', 'nickname', 'password', 'avatar')) 70 array_flip(array('email', 'nickname', 'password', 'avatar'))
61 )); 71 ));
62 unset($v); 72 unset($v);
63 - if (!Validate::is($params['email'], "email")) { 73 + /*if (!Validate::is($params['email'], "email")) {
64 $this->error(__("Please input correct email")); 74 $this->error(__("Please input correct email"));
65 - } 75 + }*/
66 if (isset($params['password'])) { 76 if (isset($params['password'])) {
67 if (!Validate::is($params['password'], "/^[\S]{6,16}$/")) { 77 if (!Validate::is($params['password'], "/^[\S]{6,16}$/")) {
68 $this->error(__("Please input correct password")); 78 $this->error(__("Please input correct password"));
@@ -70,15 +80,19 @@ class Profile extends Backend @@ -70,15 +80,19 @@ class Profile extends Backend
70 $params['salt'] = Random::alnum(); 80 $params['salt'] = Random::alnum();
71 $params['password'] = md5(md5($params['password']) . $params['salt']); 81 $params['password'] = md5(md5($params['password']) . $params['salt']);
72 } 82 }
73 - $exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find(); 83 + /*$exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find();
74 if ($exist) { 84 if ($exist) {
75 $this->error(__("Email already exists")); 85 $this->error(__("Email already exists"));
76 - } 86 + }*/
77 if ($params) { 87 if ($params) {
78 $admin = Admin::get($this->auth->id); 88 $admin = Admin::get($this->auth->id);
79 $admin->save($params); 89 $admin->save($params);
80 //因为个人资料面板读取的Session显示,修改自己资料后同时更新Session 90 //因为个人资料面板读取的Session显示,修改自己资料后同时更新Session
81 Session::set("admin", $admin->toArray()); 91 Session::set("admin", $admin->toArray());
  92 + $store_id = Db::name('admin')->where(['id'=>$this->auth->id])->value('store_id');
  93 + if(!empty($store_id)){
  94 + echo Db::name('store')->where(['id'=>$store_id])->update(['money'=>$money,'freight'=>$freight,'phone'=>$phone,'address'=>$address,'lng'=>$lng,'lat'=>$lat,'content'=>$content]);
  95 + }
82 $this->success(); 96 $this->success();
83 } 97 }
84 $this->error(); 98 $this->error();
@@ -63,10 +63,10 @@ @@ -63,10 +63,10 @@
63 <label for="username" class="control-label">{:__('Username')}:</label> 63 <label for="username" class="control-label">{:__('Username')}:</label>
64 <input type="text" class="form-control" id="username" name="row[username]" value="{$admin.username|htmlentities}" disabled/> 64 <input type="text" class="form-control" id="username" name="row[username]" value="{$admin.username|htmlentities}" disabled/>
65 </div> 65 </div>
66 - <div class="form-group"> 66 + <!--<div class="form-group">
67 <label for="email" class="control-label">{:__('Email')}:</label> 67 <label for="email" class="control-label">{:__('Email')}:</label>
68 <input type="text" class="form-control" id="email" name="row[email]" value="{$admin.email|htmlentities}" data-rule="required;email"/> 68 <input type="text" class="form-control" id="email" name="row[email]" value="{$admin.email|htmlentities}" data-rule="required;email"/>
69 - </div> 69 + </div>-->
70 <div class="form-group"> 70 <div class="form-group">
71 <label for="nickname" class="control-label">{:__('Nickname')}:</label> 71 <label for="nickname" class="control-label">{:__('Nickname')}:</label>
72 <input type="text" class="form-control" id="nickname" name="row[nickname]" value="{$admin.nickname|htmlentities}" data-rule="required"/> 72 <input type="text" class="form-control" id="nickname" name="row[nickname]" value="{$admin.nickname|htmlentities}" data-rule="required"/>
@@ -75,6 +75,36 @@ @@ -75,6 +75,36 @@
75 <label for="password" class="control-label">{:__('Password')}:</label> 75 <label for="password" class="control-label">{:__('Password')}:</label>
76 <input type="password" class="form-control" id="password" placeholder="{:__('Leave password blank if dont want to change')}" autocomplete="new-password" name="row[password]" value="" data-rule="password"/> 76 <input type="password" class="form-control" id="password" placeholder="{:__('Leave password blank if dont want to change')}" autocomplete="new-password" name="row[password]" value="" data-rule="password"/>
77 </div> 77 </div>
  78 + {notempty name="$admin.store_id"}
  79 + <div class="form-group">
  80 + <label class="control-label">{:__('满免运费价格')}:</label>
  81 + <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="text" value="{$row.money|htmlentities}">
  82 + </div>
  83 + <div class="form-group">
  84 + <label class="control-label">{:__('运费')}:</label>
  85 + <input id="c-freight" data-rule="required" class="form-control" name="row[freight]" type="text" value="{$row.freight|htmlentities}">
  86 + </div>
  87 + <div class="form-group">
  88 + <label class="control-label">{:__('联系电话')}:</label>
  89 + <input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}">
  90 + </div>
  91 + <div class="form-group address">
  92 + <label class="control-label">{:__('详细地址')}:</label>
  93 + <input id="c-address" data-toggle="addresspicker" data-input-id="c-address" data-lat-id="c-latitude" data-lng-id="c-longitude" class="form-control" data-rule="required" name="row[address]" value="{$row.address|htmlentities}" type="text" readonly="true">
  94 + </div>
  95 + <div class="form-group hidden">
  96 + <label class="control-label">{:__('Lng')}:</label>
  97 + <input id="c-longitude" class="form-control" name="row[lng]" type="text" value="{$row.lng|htmlentities}">
  98 + </div>
  99 + <div class="form-group hidden">
  100 + <label class="control-label">{:__('Lat')}:</label>
  101 + <input id="c-latitude" class="form-control" name="row[lat]" type="text" value="{$row.lat|htmlentities}">
  102 + </div>
  103 + <div class="form-group">
  104 + <label class="control-label">{:__('Content')}:</label>
  105 + <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
  106 + </div>
  107 + {/notempty}
78 <div class="form-group"> 108 <div class="form-group">
79 <button type="submit" class="btn btn-success">{:__('Submit')}</button> 109 <button type="submit" class="btn btn-success">{:__('Submit')}</button>
80 <button type="reset" class="btn btn-default">{:__('Reset')}</button> 110 <button type="reset" class="btn btn-default">{:__('Reset')}</button>
@@ -623,7 +623,7 @@ @@ -623,7 +623,7 @@
623 val++; 623 val++;
624 $(self.closest('li').find('.contInput')[0]).val(val); 624 $(self.closest('li').find('.contInput')[0]).val(val);
625 contPrice(self, val); 625 contPrice(self, val);
626 - toast('操作成功'); 626 + // toast('操作成功');
627 }else{ 627 }else{
628 toast(res.msg); 628 toast(res.msg);
629 } 629 }