|
@@ -4,7 +4,7 @@ namespace Mshop\Src;
|
|
|
|
|
|
|
|
use Dever;
|
|
use Dever;
|
|
|
|
|
|
|
|
-class Main extends Core
|
|
|
|
|
|
|
+class Main
|
|
|
{
|
|
{
|
|
|
# 登录
|
|
# 登录
|
|
|
public function login()
|
|
public function login()
|
|
@@ -14,17 +14,20 @@ class Main extends Core
|
|
|
$user = Dever::db('shop/member')->select($where);
|
|
$user = Dever::db('shop/member')->select($where);
|
|
|
|
|
|
|
|
if ($user) {
|
|
if ($user) {
|
|
|
- $this->data['uid'] = $user['id'];
|
|
|
|
|
- $this->data['signature'] = Dever::login($user['id']);
|
|
|
|
|
- $this->data['user'] = $user;
|
|
|
|
|
|
|
+ $this->data['uid'] = $user[0]['id'];
|
|
|
|
|
+ $this->data['signature'] = Dever::login($this->data['uid']);
|
|
|
$this->data['shop'] = array();
|
|
$this->data['shop'] = array();
|
|
|
- $this->data['shop_num'] = count($user);
|
|
|
|
|
$this->data['shop_id'] = false;
|
|
$this->data['shop_id'] = false;
|
|
|
foreach ($user as $k => $v) {
|
|
foreach ($user as $k => $v) {
|
|
|
- $this->data['shop'][] = Dever::db('shop/info')->getOne($v['shop_id']);
|
|
|
|
|
- $this->data['shop_id'] = $v['shop_id'];
|
|
|
|
|
|
|
+ $shop = Dever::db('shop/info')->getOne($v['shop_id']);
|
|
|
|
|
+ if ($shop) {
|
|
|
|
|
+ $this->data['shop'][] = Dever::db('shop/info')->getOne($v['shop_id']);
|
|
|
|
|
+ $this->data['shop_id'] = $v['shop_id'];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $this->data['shop_num'] = count($this->data['shop']);
|
|
|
|
|
+
|
|
|
return $this->data;
|
|
return $this->data;
|
|
|
} else {
|
|
} else {
|
|
|
Dever::alert('登录失败,手机号不存在');
|
|
Dever::alert('登录失败,手机号不存在');
|
|
@@ -34,7 +37,7 @@ class Main extends Core
|
|
|
# 获取验证码
|
|
# 获取验证码
|
|
|
public function mcode()
|
|
public function mcode()
|
|
|
{
|
|
{
|
|
|
- $mobile = Dever::load('passport/reg')->checkMobileExists(1, -1, 'shop/member');
|
|
|
|
|
|
|
+ $mobile = Dever::load('passport/reg')->checkMobileExists(1, true, 'shop/member');
|
|
|
|
|
|
|
|
$msg = Dever::load('passport/reg')->getMcode_action($mobile);
|
|
$msg = Dever::load('passport/reg')->getMcode_action($mobile);
|
|
|
|
|
|
|
@@ -47,7 +50,6 @@ class Main extends Core
|
|
|
$data['name'] = Dever::input('name');
|
|
$data['name'] = Dever::input('name');
|
|
|
$data['mobile'] = Dever::input('mobile');
|
|
$data['mobile'] = Dever::input('mobile');
|
|
|
$data['city'] = Dever::input('city');
|
|
$data['city'] = Dever::input('city');
|
|
|
- $data['uid'] = $this->uid;
|
|
|
|
|
|
|
|
|
|
if (!$data['name']) {
|
|
if (!$data['name']) {
|
|
|
Dever::alert('请输入姓名');
|
|
Dever::alert('请输入姓名');
|
|
@@ -64,23 +66,19 @@ class Main extends Core
|
|
|
if (!$info) {
|
|
if (!$info) {
|
|
|
$data['truename'] = $data['name'];
|
|
$data['truename'] = $data['name'];
|
|
|
# 根据城市查找省份
|
|
# 根据城市查找省份
|
|
|
|
|
+ $county = Dever::db('area/county')->find($data['city']);
|
|
|
|
|
+ if ($county) {
|
|
|
|
|
+ $data['city'] = $county['city_id'];
|
|
|
|
|
+ }
|
|
|
$city = Dever::db('area/city')->find($data['city']);
|
|
$city = Dever::db('area/city')->find($data['city']);
|
|
|
$data['province'] = $city['province_id'];
|
|
$data['province'] = $city['province_id'];
|
|
|
$data['area'] = $data['province'] . ',' . $data['city'];
|
|
$data['area'] = $data['province'] . ',' . $data['city'];
|
|
|
|
|
+ if ($county) {
|
|
|
|
|
+ $data['area'] .= ',' . $county['id'];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
# 获取经纬度
|
|
# 获取经纬度
|
|
|
- $url = 'https://restapi.amap.com/v3/geocode/geo';
|
|
|
|
|
- $param['key'] = 'f18cb42560b8aa54e3b53a6265bfd764';
|
|
|
|
|
- $param['city'] = $data['city'];
|
|
|
|
|
- $param['address'] = $city['name'];
|
|
|
|
|
- $result = json_decode(Dever::curl($url, $param), true);
|
|
|
|
|
-
|
|
|
|
|
- if (isset($result['geocodes'][0]['location']) && $result['geocodes'][0]['location']) {
|
|
|
|
|
- $data['map'] = $city['name'] . ',' . $result['geocodes'][0]['location'] . ',11';
|
|
|
|
|
- $temp = explode(',', $result['geocodes'][0]['location']);
|
|
|
|
|
- $data['lng'] = $temp[0];
|
|
|
|
|
- $data['lat'] = $temp[1];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ list($data['lng'], $data['lat'], $data['map']) = Dever::load('shop/lib/info')->geo($data['city'], $city['name']);
|
|
|
|
|
|
|
|
$data['status'] = 3;
|
|
$data['status'] = 3;
|
|
|
Dever::db('shop/info')->insert($data);
|
|
Dever::db('shop/info')->insert($data);
|