修改自提点添加方式
This commit is contained in:
parent
8f3b9b2411
commit
7df498930c
@ -15,7 +15,7 @@ use think\facade\Db;
|
||||
|
||||
class LocalStore extends Api
|
||||
{
|
||||
public $like_not_need_login = ['makeMyPayImage', 'getLocalShopById', 'getLocalList', 'getLocation'];
|
||||
public $like_not_need_login = ['makeMyPayImage', 'getLocalShopById', 'getLocalList', 'getLocation', 'addPostStation'];
|
||||
|
||||
public function getLocalStore()
|
||||
{
|
||||
@ -242,10 +242,6 @@ class LocalStore extends Api
|
||||
$model = new LocalStoreLogic;
|
||||
$result['distance'] = round($model->distance($result['latitude'], $result['longitude'], $latitude, $longitude) / 1000, 2) . "公里";
|
||||
$result['header_image'] = FileConfig::get('aliyunoss.domain') . 'local_life_shop/' . $result['header_image'];
|
||||
|
||||
if ($result['post_station']) {
|
||||
$result['post_station'] = json_decode($result['post_station'], true);
|
||||
}
|
||||
return JsonServer::success('成功获取', $result);
|
||||
}
|
||||
|
||||
@ -354,11 +350,11 @@ class LocalStore extends Api
|
||||
}
|
||||
|
||||
// 设置自提站点
|
||||
public function setPostStation()
|
||||
public function addPostStation()
|
||||
{
|
||||
try {
|
||||
$post = $this->request->post();
|
||||
LocalStoreLogic::setPostStation($post, $this->user_id);
|
||||
LocalStoreLogic::addPostStation($post, $this->user_id);
|
||||
return JsonServer::success('设置成功');
|
||||
} catch (\Exception $e) {
|
||||
return JsonServer::error($e->getMessage());
|
||||
|
||||
@ -6,8 +6,10 @@ use app\common\basics\Logic;
|
||||
use app\common\model\LocalStore;
|
||||
use app\common\model\localstore\LocalGoodsStore;
|
||||
use app\common\model\LocalStoreOrder;
|
||||
use app\common\model\LocalStorePostStation;
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
|
||||
class LocalStoreLogic extends Logic
|
||||
{
|
||||
public function getLocalList($data)
|
||||
@ -353,7 +355,7 @@ class LocalStoreLogic extends Logic
|
||||
];
|
||||
}
|
||||
|
||||
public static function setPostStation($post, $user_id)
|
||||
public static function addPostStation($post, $user_id)
|
||||
{
|
||||
if (!$post['province'] && !$post['city'] && !$post['area'] && !$post['address']) {
|
||||
throw new \Exception('未选择区域');
|
||||
@ -366,10 +368,7 @@ class LocalStoreLogic extends Logic
|
||||
$lstore_id = $post['lstore_id'];
|
||||
unset($post['lstore_id']);
|
||||
|
||||
$result = LocalStore::where(['user_id' => $user_id, 'lstore_id' => $lstore_id])->update([
|
||||
'post_station' => json_encode($post, JSON_UNESCAPED_UNICODE),
|
||||
'update_time' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
$result = LocalStorePostStation::where(['user_id' => $user_id, 'lstore_id' => $lstore_id])->insert($post);
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
|
||||
@ -13,4 +13,9 @@ class LocalStore extends Model
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id')->field('id, nickname');
|
||||
}
|
||||
|
||||
public function post_station()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
app/common/model/LocalStorePostStation.php
Executable file
11
app/common/model/LocalStorePostStation.php
Executable file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\model\user\User;
|
||||
use think\Model;
|
||||
|
||||
class LocalStorePostStation extends Model
|
||||
{
|
||||
protected $name = 'local_store_post_station';
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user