|
@@ -77,6 +77,12 @@ class Package extends Apic
|
|
if (!$package_id) {
|
|
if (!$package_id) {
|
|
throw new Exception('添加套餐失败');
|
|
throw new Exception('添加套餐失败');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ $fileName = md5($package_id);
|
|
|
|
+ $fileUrl = '/uploads/package/'.$fileName.'.png';
|
|
|
|
+ Db::name('package')->where('id',$package_id)->update(['mini_code'=>$fileUrl]);
|
|
|
|
+
|
|
|
|
+
|
|
if (isset($data['type']) && $data['type'] == 2) {
|
|
if (isset($data['type']) && $data['type'] == 2) {
|
|
$gift_data = input('gift_data','','trim');
|
|
$gift_data = input('gift_data','','trim');
|
|
$gift_data = json_decode(htmlspecialchars_decode($gift_data),true);
|
|
$gift_data = json_decode(htmlspecialchars_decode($gift_data),true);
|
|
@@ -174,10 +180,15 @@ class Package extends Apic
|
|
$data = request_post_hub($field);
|
|
$data = request_post_hub($field);
|
|
$data['updatetime'] = time();
|
|
$data['updatetime'] = time();
|
|
|
|
|
|
|
|
+ $fileName = md5($id);
|
|
|
|
+ $fileUrl = '/uploads/package/'.$fileName.'.png';
|
|
|
|
+ $data['mini_code'] = $fileUrl;
|
|
|
|
+
|
|
$packageRes = Db::name('package')->where('id',$id)->update($data);
|
|
$packageRes = Db::name('package')->where('id',$id)->update($data);
|
|
if (!$packageRes) {
|
|
if (!$packageRes) {
|
|
throw new Exception('套餐编辑失败');
|
|
throw new Exception('套餐编辑失败');
|
|
}
|
|
}
|
|
|
|
+
|
|
if ($check['type'] == 2) {
|
|
if ($check['type'] == 2) {
|
|
$packageGiftWhere['package_id'] = $id;
|
|
$packageGiftWhere['package_id'] = $id;
|
|
$packageGiftData = Db::name('package_gift')->where($packageGiftWhere)->select();
|
|
$packageGiftData = Db::name('package_gift')->where($packageGiftWhere)->select();
|
|
@@ -284,10 +295,6 @@ class Package extends Apic
|
|
$code = $res2->getBody()->getContents();
|
|
$code = $res2->getBody()->getContents();
|
|
file_put_contents(ROOT_PATH.'/public'.$fileUrl,$code);
|
|
file_put_contents(ROOT_PATH.'/public'.$fileUrl,$code);
|
|
|
|
|
|
- $companyRes = Db::name('package')->where('id',$id)->update(['mini_code'=>$fileUrl]);
|
|
|
|
- if ($companyRes === false) {
|
|
|
|
- //$this->error('生成套餐小程序码失败');
|
|
|
|
- }
|
|
|
|
$miniCode = $httpStr.$fileUrl;
|
|
$miniCode = $httpStr.$fileUrl;
|
|
} else {
|
|
} else {
|
|
$miniCode = $httpStr.$package['mini_code'];
|
|
$miniCode = $httpStr.$package['mini_code'];
|