Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
4d462cbabb
@ -6,8 +6,6 @@ use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\beforehand_order\BeforehandOrder;
|
||||
use app\common\model\finance\AccountsReceivable;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\user\User;
|
||||
use Illuminate\Contracts\Cache\Store;
|
||||
|
||||
/**
|
||||
* AccountsReceivableLists
|
||||
@ -51,6 +49,8 @@ class AccountsReceivableLists extends BaseAdminDataLists implements ListsSearchI
|
||||
foreach ($list as &$item) {
|
||||
$item['store_name'] = $stores[$item['store_id']]['name'];
|
||||
$item['order_sn'] = $orderInfo[$item['order_id']]['order_id'];
|
||||
$item['debt_day'] = intval((time() - strtotime($item['create_time'])) / 86400);
|
||||
$item['deadline'] = date('Y-m-d H:i:s', $item['deadline']);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
@ -32,91 +32,4 @@ class AccountsReceivableLogic extends BaseLogic
|
||||
$model->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/12/20 10:52
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ActivityZone::where('id', $params['id'])->update([
|
||||
'form_id' => $params['form_id'],
|
||||
'product_id' => $params['product_id'],
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/12/20 10:52
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ActivityZone::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author admin
|
||||
* @date 2024/12/20 10:52
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return ActivityZone::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
public function addProduct($product)
|
||||
{
|
||||
$activityFormId1 = ActivityZoneForm::whereRaw('FIND_IN_SET(:cate_id,cate_ids)', ['cate_id' => $product['two_cate_id']])->column('id');
|
||||
$activityFormId2 = ActivityZoneForm::whereRaw('FIND_IN_SET(:cate_id,cate_ids)', ['cate_id' => $product['cate_id']])->column('id');
|
||||
$activityFormIds = array_unique(array_merge($activityFormId1, $activityFormId2));
|
||||
foreach ($activityFormIds as $activityFormId) {
|
||||
$activityZone = new ActivityZone();
|
||||
$activityZone->form_id = $activityFormId;
|
||||
$activityZone->product_id = $product['id'];
|
||||
$activityZone->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateProduct($productId, $product)
|
||||
{
|
||||
$product['id'] = $productId;
|
||||
$formIds = ActivityZone::where('product_id', $productId)->column('form_id');
|
||||
if (empty($formIds)) {
|
||||
$this->addProduct($product);
|
||||
return;
|
||||
}
|
||||
$forms = ActivityZoneForm::whereIn('id', $formIds)->select()->toArray();
|
||||
foreach ($forms as $form) {
|
||||
$cateIds = explode(',', $form['cate_ids']);
|
||||
if (!in_array($product['two_cate_id'], $cateIds) && !in_array($product['cate_id'], $cateIds)) {
|
||||
ActivityZone::where('product_id', $productId)->where('form_id', $form['id'])->update(['delete_time' => time()]);
|
||||
}
|
||||
$this->addProduct($product);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteProduct($productId)
|
||||
{
|
||||
ActivityZone::where('product_id', $productId)->update(['delete_time' => time()]);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user