配置修改

This commit is contained in:
2026-07-13 16:33:09 +08:00
parent 9998f4651b
commit d1a15a4c42
15 changed files with 348 additions and 38 deletions

View File

@ -27,6 +27,7 @@ use app\common\model\distribution\Distribution;
use app\common\model\distribution\DistributionLevel;
use app\common\server\ConfigServer;
use app\common\model\user\UserDistribution;
use app\common\logic\CityLogic;
use app\common\model\user\User;
use app\common\model\distribution\DistributionMemberApply;
use app\common\model\distribution\DistributionOrderGoods;
@ -133,7 +134,11 @@ class DistributionLogic extends Logic
'update_time' => $time,
];
DistributionMemberApply::create($data);
User::where("id",$user_id)->update(['url'=>$url['data']['qr_code']]);
$userUpdate = ['url' => $url['data']['qr_code']];
if (!empty($post['city'])) {
$userUpdate['city_id'] = (int)$post['city'];
}
User::where("id", $user_id)->update($userUpdate);
$distribution = Distribution::where("user_id",$user_id)->find();
$defaultLevelId = DistributionLevel::where('is_default', 1)->value('id');
$data = [
@ -263,7 +268,7 @@ class DistributionLogic extends Logic
try {
Db::startTrans();
$firstLeader = User::field(['id', 'first_leader', 'second_leader', 'third_leader', 'ancestor_relation','user_integral'])
$firstLeader = User::field(['id', 'first_leader', 'second_leader', 'third_leader', 'ancestor_relation','user_integral', 'city_id'])
->where(['distribution_code' => $post['code']])
->findOrEmpty();
if($firstLeader->isEmpty()) {
@ -298,6 +303,12 @@ class DistributionLogic extends Logic
'update_time' => time()
];
// 扫码进入时继承码主人的所属城市
$ownerCityId = CityLogic::getUserCityId((int)$firstLeader['id']);
if ($ownerCityId > 0) {
$data['city_id'] = $ownerCityId;
}
// 更新当前用户的分销关系
User::where(['id' => $post['user_id']])->update($data);
@ -368,7 +379,7 @@ class DistributionLogic extends Logic
try {
Db::startTrans();
$firstLeader = User::field(['id', 'first_leader', 'second_leader', 'third_leader', 'ancestor_relation','user_integral'])
$firstLeader = User::field(['id', 'first_leader', 'second_leader', 'third_leader', 'ancestor_relation','user_integral', 'city_id'])
->where(['id' => $post['user_id']])
->findOrEmpty();
if($firstLeader->isEmpty()) {
@ -389,6 +400,11 @@ class DistributionLogic extends Logic
'update_time' => time()
];
$ownerCityId = CityLogic::getUserCityId((int)$firstLeader['id']);
if ($ownerCityId > 0) {
$data['city_id'] = $ownerCityId;
}
// 更新当前用户的分销关系
User::where(['id' => $user_id])->update($data);
//通知用户