parent
beaae893ff
commit
3d83f49ea7
|
|
@ -435,7 +435,7 @@ class Common extends BaseController
|
||||||
public function test(){
|
public function test(){
|
||||||
|
|
||||||
|
|
||||||
// $this->sqlInit();
|
$this->sqlInit();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -443,39 +443,112 @@ class Common extends BaseController
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******** 数据库批量处理 ***************************************/
|
/******** 数据库批量处理 ***************************************/
|
||||||
private function sqlInit(){
|
private function sqlInit(){
|
||||||
// 不清除数据的表
|
// 不清除数据的表
|
||||||
$notCleanUp = [
|
$notCleanUp = [
|
||||||
|
// 系统
|
||||||
|
'tk_cache',
|
||||||
|
'tk_city_area',
|
||||||
|
'tk_diy',
|
||||||
|
'tk_express',
|
||||||
|
'tk_relevance',
|
||||||
|
'tk_system_admin',
|
||||||
|
'tk_system_attachment',
|
||||||
|
'tk_system_attachment_category',
|
||||||
|
'tk_system_config',
|
||||||
|
'tk_system_config_classify',
|
||||||
|
'tk_system_config_value',
|
||||||
|
'tk_system_group',
|
||||||
|
'tk_system_group_data',
|
||||||
|
'tk_system_menu',
|
||||||
|
'tk_system_notice_config',
|
||||||
|
'tk_system_role',
|
||||||
|
'tk_template_message',
|
||||||
|
// 反馈建议
|
||||||
|
'tk_feedback_category',
|
||||||
|
// 保障服务
|
||||||
|
'tk_guarantee',
|
||||||
|
'tk_guarantee_template',
|
||||||
|
'tk_guarantee_value',
|
||||||
|
// 平台&商户积分
|
||||||
|
'tk_integral',
|
||||||
|
'tk_integral_give_record',
|
||||||
|
// 用户相关
|
||||||
|
'tk_member_interests',
|
||||||
|
// 'tk_user',
|
||||||
|
// 'tk_user_address',
|
||||||
|
// 'tk_user_brokerage',
|
||||||
|
// 'tk_wechat_user',
|
||||||
|
// 商户相关
|
||||||
|
'tk_merchant',
|
||||||
|
'tk_merchant_admin',
|
||||||
|
'tk_merchant_category',
|
||||||
|
'tk_merchant_intention',
|
||||||
|
'tk_merchant_type',
|
||||||
|
'tk_shipping_template',
|
||||||
|
'tk_shipping_template_free',
|
||||||
|
'tk_shipping_template_region',
|
||||||
|
'tk_shipping_template_undelivery',
|
||||||
|
// 装修相关
|
||||||
|
'tk_page_category',
|
||||||
|
'tk_page_link',
|
||||||
|
// 商品相关
|
||||||
|
'tk_parameter',
|
||||||
|
'tk_parameter_template',
|
||||||
|
'tk_parameter_value',
|
||||||
|
'price_rule',
|
||||||
|
'tk_store_attr_template',
|
||||||
|
'tk_store_brand',
|
||||||
|
'tk_store_brand_category',
|
||||||
|
'tk_store_category',
|
||||||
|
'tk_store_product',
|
||||||
|
'tk_store_product_attr',
|
||||||
|
'tk_store_product_attr_value',
|
||||||
|
'tk_store_product_cate',
|
||||||
|
'tk_store_product_content',
|
||||||
|
'tk_store_product_label',
|
||||||
|
'tk_store_spu',
|
||||||
|
// 'tk_store_product_reply',// 商品评论
|
||||||
|
// 商品助力
|
||||||
|
// 'tk_store_product_assist',
|
||||||
|
// 'tk_store_product_assist_set',
|
||||||
|
// 'tk_store_product_assist_sku',
|
||||||
|
// 'tk_store_product_assist_user',
|
||||||
|
// 优惠券相关
|
||||||
|
// 'tk_store_coupon',
|
||||||
|
// 'tk_store_coupon_issue_user',
|
||||||
|
// 'tk_store_coupon_product',
|
||||||
|
// 'tk_store_coupon_send',
|
||||||
|
// 'tk_store_coupon_user',
|
||||||
|
// 套餐相关
|
||||||
|
// 'tk_store_discounts',
|
||||||
|
// 'tk_store_discounts_product',
|
||||||
|
// 拼团商品
|
||||||
|
// 'tk_store_product_group',
|
||||||
|
// 'tk_store_product_group_buying',
|
||||||
|
// 'tk_store_product_group_sku',
|
||||||
|
// 'tk_store_product_group_user',
|
||||||
|
// 预售商品
|
||||||
|
// 'tk_store_product_presell',
|
||||||
|
// 'tk_store_product_presell_sku',
|
||||||
|
// 活动商品
|
||||||
|
// 'tk_store_product_sku',
|
||||||
|
// 供应商
|
||||||
|
'tk_system_supplier',
|
||||||
];
|
];
|
||||||
// 获取全部数据库列表
|
// 获取全部数据库列表
|
||||||
$tables = $this->getAllTable();
|
$tables = $this->getAllTable();
|
||||||
// 获取存在数据的表
|
// 获取存在数据的表
|
||||||
// $hasTable = $this->getHasDataTable($tables,$notCleanUp);
|
// $hasTable = $this->getHasSpecifyDataTable($tables,$notCleanUp);
|
||||||
|
$hasTable = $this->getHasDataTable($tables,$notCleanUp);
|
||||||
|
|
||||||
debug($tables);
|
debug($hasTable);
|
||||||
// 执行清除操作
|
// 执行清除操作
|
||||||
// foreach($tables as $name){
|
// foreach($tables as $name){
|
||||||
// if(!in_array($name,$notCleanUp)){
|
// if(!in_array($name,$notCleanUp)){
|
||||||
// // 判断:是否操作uniacid=0的数据 存在则执行删除存在,不存在则执行清除操作
|
// // 执行清除操作
|
||||||
// $tableName = str_replace('ims_','',$name);
|
// $res = Db::query('TRUNCATE TABLE '.$name.';');
|
||||||
// if($this->isHasZeroData($name)){
|
|
||||||
// // echo $name."=有","<br />";
|
|
||||||
// $columns = \DB::select('SHOW COLUMNS FROM '.$name);
|
|
||||||
// $fields = array_column($columns,'Field');
|
|
||||||
// $primaryKey = $fields[0];
|
|
||||||
// $max = \DB::table($tableName)->where('uniacid',0)->max($primaryKey);
|
|
||||||
// \DB::table($tableName)->where('uniacid','>',0)->delete();
|
|
||||||
// // \DB::select('alter table '.$name.' AUTO_INCREMENT='.$max);
|
|
||||||
// }else{
|
|
||||||
// \DB::select('TRUNCATE TABLE '.$name.';');
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
@ -487,8 +560,25 @@ class Common extends BaseController
|
||||||
$tables = Db::query('SHOW TABLES');
|
$tables = Db::query('SHOW TABLES');
|
||||||
return array_column($tables,'Tables_in_'.$database);
|
return array_column($tables,'Tables_in_'.$database);
|
||||||
}
|
}
|
||||||
// 数据库处理 - 获取存在数据的表
|
// 数据库处理 - 获取存在数据的表(任意数据)
|
||||||
private function getHasDataTable($tables,$notCleanUp){
|
private function getHasDataTable($tables,$notCleanUp){
|
||||||
|
$tableList = [];
|
||||||
|
foreach($tables as $tableName){
|
||||||
|
if(!in_array($tableName,$notCleanUp)){
|
||||||
|
// echo "{$tableName}<br />\n\r";
|
||||||
|
// 获取字段信息
|
||||||
|
$result = Db::query("select count(*) as count_data from {$tableName}");
|
||||||
|
$countData = $result[0]['count_data'] ?? 0;
|
||||||
|
if($countData > 0){
|
||||||
|
$tableList[] = $tableName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tableList;
|
||||||
|
}
|
||||||
|
// 数据库处理 - 获取存在指定数据的表
|
||||||
|
private function getHasSpecifyDataTable($tables,$notCleanUp){
|
||||||
$tableList = [];
|
$tableList = [];
|
||||||
foreach($tables as $tableName){
|
foreach($tables as $tableName){
|
||||||
if(!in_array($tableName,$notCleanUp)){
|
if(!in_array($tableName,$notCleanUp)){
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,7 @@ class Auth extends BaseController
|
||||||
}
|
}
|
||||||
$res = $userRepository->bindSpread($this->request->userInfo(), intval($data['spread_spid']));
|
$res = $userRepository->bindSpread($this->request->userInfo(), intval($data['spread_spid']));
|
||||||
|
|
||||||
return app('json')->success($res);
|
return app('json')->success($res ?? 'success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ class PlatformCommission extends BaseController{
|
||||||
public function recordList(){
|
public function recordList(){
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$params = $this->request->params(['uid','legumes_id','status']);
|
$params = $this->request->params(['uid','legumes_id','status']);
|
||||||
|
$params['uid'] = $this->request->uid();
|
||||||
$data = app()->make(LegumesLogRepository::class)->getRecordList((array)$params,(int)$page,(int)$limit);
|
$data = app()->make(LegumesLogRepository::class)->getRecordList((array)$params,(int)$page,(int)$limit);
|
||||||
|
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue