master
wangxinglong 2022-04-07 13:59:03 +08:00
parent 74c3e5c092
commit 69004bee30
2 changed files with 18 additions and 1 deletions

View File

@ -12,6 +12,7 @@ use app\model\Member;
use app\model\BusinessCircle as BusinessCircleModel ; use app\model\BusinessCircle as BusinessCircleModel ;
use app\repository\AccountRepository; use app\repository\AccountRepository;
use app\repository\BusinessRepository; use app\repository\BusinessRepository;
use app\repository\CouponRepository;
use app\repository\RechargeRepository; use app\repository\RechargeRepository;
use app\service\wx\WechatPay; use app\service\wx\WechatPay;
use Endroid\QrCode\Builder\Builder; use Endroid\QrCode\Builder\Builder;
@ -228,7 +229,7 @@ class Business extends Base
'type|分类' => 'require|number', 'type|分类' => 'require|number',
//'characteristic|特色' => 'max:100', //'characteristic|特色' => 'max:100',
// 'intro|介绍' => 'require', // 'intro|介绍' => 'require',
// 'business_circle_id|商圈' => 'require', 'business_circle_id|商圈' => 'require',
'background|背景图' => 'require', 'background|背景图' => 'require',
'model|商家模式' => 'require', 'model|商家模式' => 'require',
//'score|评分' => 'require|in:1,2,3,4,5', //'score|评分' => 'require|in:1,2,3,4,5',
@ -246,6 +247,11 @@ class Business extends Base
Db::startTrans(); Db::startTrans();
try { try {
$business->save($item); $business->save($item);
//修改所属的签到券
CouponRepository::getInstance()->updateCouponMainByBusinessCode($business["code"],[
"business_circle_id"=>$item["business_circle_id"],
"business_type"=>$item["type"],
]);
Db::commit(); Db::commit();
return $this->json(); return $this->json();
} catch (ValidateException $e) { } catch (ValidateException $e) {

View File

@ -110,4 +110,15 @@ class CouponRepository extends Repository
{ {
return Coupon::create($data); return Coupon::create($data);
} }
/**
* 根据商家id修改优惠券
* @param array $data
* @return Coupon|Model
*/
public function updateCouponMainByBusinessCode(int $businessCode,array $data)
{
return CouponMain::where("business_code",$businessCode)->update($data);
}
} }