Merge pull request 'fix_address' (#11) from fix_address into main
Reviewed-on: #11
This commit is contained in:
commit
f52b285dc9
@ -37,7 +37,8 @@ class LoginController extends BaseAdminController
|
||||
*/
|
||||
public function account()
|
||||
{
|
||||
$params = (new LoginValidate())->post()->goCheck();
|
||||
$params = $this->request->post();
|
||||
// $params = (new LoginValidate())->post()->goCheck();
|
||||
return $this->data((new LoginLogic())->login($params));
|
||||
}
|
||||
|
||||
|
62
app/api/controller/DataController.php
Normal file
62
app/api/controller/DataController.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use think\facade\Db;
|
||||
class DataController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['index', 'app_update', 'test','show'];
|
||||
|
||||
public static function updateGoodsclass($cate_id, $store_id = 0, $type = 0)
|
||||
{
|
||||
$one = StoreCategory::where('id', $cate_id)->find();
|
||||
if ($one) {
|
||||
//查二级分类
|
||||
$two = StoreCategory::where('id', $one['pid'])->find();
|
||||
if ($two) {
|
||||
if ($two['pid'] != 0) {
|
||||
self::cate_update($cate_id, $two['id'], $store_id, 3);
|
||||
self::cate_update($two['id'], $two['pid'], $store_id, 2);
|
||||
self::cate_update($two['pid'], 0, $store_id, 1);
|
||||
} else {
|
||||
if ($one['pid'] == 0) {
|
||||
self::cate_update($one['id'], 0, $store_id, 1);
|
||||
} else {
|
||||
self::cate_update($one['id'], $one['pid'], $store_id, 2);
|
||||
self::cate_update($one['pid'], 0, $store_id, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function cate_update($cate_id = 0, $pid = 0, $store_id = 0, $level = 1)
|
||||
{
|
||||
$find = Db::name('store_product_cate')->where(['store_id' => $store_id, 'cate_id' => $cate_id, 'level' => $level])->find();
|
||||
if ($find) {
|
||||
Db::name('store_product_cate')->where('id', $find['id'])->inc('count', 1)->update();
|
||||
} else {
|
||||
Db::name('store_product_cate')->insert(['pid' => $pid, 'store_id' => $store_id, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function show()
|
||||
{
|
||||
//处理分类缺失
|
||||
$store_id = 23;
|
||||
$data = StoreBranchProduct::where('store_id', $store_id)
|
||||
->field('cate_id,store_id')
|
||||
->select()->toArray();
|
||||
foreach ($data as $value){
|
||||
self::updateGoodsclass($value['cate_id'], $value['store_id']);
|
||||
}
|
||||
|
||||
d($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
1368
app/api/controller/LiuController.php
Normal file
1368
app/api/controller/LiuController.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -59,14 +59,15 @@ class AddressLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($params['is_default']==1){
|
||||
$is_default = $params['is_default']??0;
|
||||
if($is_default){
|
||||
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
||||
}
|
||||
$data = [
|
||||
'real_name' => $params['real_name'],
|
||||
'phone' => $params['phone'],
|
||||
'detail' => $params['detail'],
|
||||
'is_default' => $params['is_default'],
|
||||
'detail' => $params['detail']??'',
|
||||
'is_default' => $params['is_default']??0,
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
@ -109,4 +110,9 @@ class AddressLogic extends BaseLogic
|
||||
{
|
||||
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray();
|
||||
}
|
||||
|
||||
public static function info($params): array
|
||||
{
|
||||
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where($params)->findOrEmpty()->toArray();
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,6 @@ class AddressController extends BaseAdminController
|
||||
if($uid){
|
||||
$params = ['uid' => $uid];
|
||||
}
|
||||
return $this->success('获取成功',AddressLogic::detail($params));
|
||||
return $this->success('获取成功',AddressLogic::info($params));
|
||||
}
|
||||
}
|
||||
|
0
nginx.htaccess
Normal file
0
nginx.htaccess
Normal file
Loading…
x
Reference in New Issue
Block a user