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