更新
This commit is contained in:
parent
16ee8284db
commit
58c27d36cd
@ -1004,7 +1004,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
if ($order['consumption_money'] > 0) {
|
if ($order['consumption_money'] > 0) {
|
||||||
$consumptionDetails[] = [
|
$consumptionDetails[] = [
|
||||||
'user_id' => $uid,
|
'user_id' => $uid,
|
||||||
'order_id' => $order['order_id'],
|
'order_id' => $_order->order_id,
|
||||||
'group_order_id' => $groupOrder->group_order_id,
|
'group_order_id' => $groupOrder->group_order_id,
|
||||||
'coupon_user_id' => $order['consumption_id'],
|
'coupon_user_id' => $order['consumption_id'],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
|
@ -57,6 +57,8 @@ use AlibabaCloud\Tea\Utils\Utils;
|
|||||||
use Darabonba\OpenApi\Models\Config;
|
use Darabonba\OpenApi\Models\Config;
|
||||||
use AlibabaCloud\SDK\Ocr\V20191230\Models\RecognizeBusinessLicenseRequest;
|
use AlibabaCloud\SDK\Ocr\V20191230\Models\RecognizeBusinessLicenseRequest;
|
||||||
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
||||||
|
use app\common\repositories\system\attachment\AttachmentRepository;
|
||||||
|
use crmeb\services\QrcodeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Common
|
* Class Common
|
||||||
@ -634,4 +636,34 @@ class Common extends BaseController
|
|||||||
Cache::set('promote_' . app('request')->ip(), $code, 86400);
|
Cache::set('promote_' . app('request')->ip(), $code, 86400);
|
||||||
return app('json')->success();
|
return app('json')->success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
*/
|
||||||
|
public function Qrcode($data)
|
||||||
|
{
|
||||||
|
$siteUrl = systemConfig('site_url');
|
||||||
|
$name = md5('orcode' . date('Ymd')) . '.jpg';
|
||||||
|
$attachmentRepository = app()->make(AttachmentRepository::class);
|
||||||
|
$imageInfo = $attachmentRepository->getWhere(['attachment_name' => $name]);
|
||||||
|
|
||||||
|
if (isset($imageInfo['attachment_src']) && strstr($imageInfo['attachment_src'], 'http') !== false && curl_file_exist($imageInfo['attachment_src']) === false) {
|
||||||
|
$imageInfo->delete();
|
||||||
|
$imageInfo = null;
|
||||||
|
}
|
||||||
|
if (!$imageInfo) {
|
||||||
|
$imageInfo = app()->make(QrcodeService::class)->getQRCodePath($data['code'], $name);
|
||||||
|
if (is_string($imageInfo)) throw new ValidateException('二维码生成失败');
|
||||||
|
|
||||||
|
$imageInfo['dir'] = tidy_url($imageInfo['dir'], null, $siteUrl);
|
||||||
|
$attachmentRepository->create(systemConfig('upload_type') ?: 1, -2, $data['id'], [
|
||||||
|
'attachment_category_id' => 0,
|
||||||
|
'attachment_name' => $imageInfo['name'],
|
||||||
|
'attachment_src' => $imageInfo['dir']
|
||||||
|
]);
|
||||||
|
$urlCode = $imageInfo['dir'];
|
||||||
|
} else $urlCode = $imageInfo['attachment_src'];
|
||||||
|
return $urlCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ use think\App;
|
|||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use app\controller\api\Common;
|
||||||
|
|
||||||
class User extends BaseController
|
class User extends BaseController
|
||||||
{
|
{
|
||||||
@ -535,4 +536,12 @@ class User extends BaseController
|
|||||||
return app('json')->success('修改成功');
|
return app('json')->success('修改成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
*/
|
||||||
|
public function qrcode(){
|
||||||
|
$common= app()->make(Common::class);
|
||||||
|
$data=$common->Qrcode(['code'=>'shop_'.$this->user->uid,'id'=>$this->user->uid]);
|
||||||
|
return app('json')->success(['url'=>$data]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ Route::group('api/', function () {
|
|||||||
//强制登录
|
//强制登录
|
||||||
Route::group(function () {
|
Route::group(function () {
|
||||||
|
|
||||||
|
Route::any('qrcode', 'api.user.User/qrcode');
|
||||||
|
|
||||||
Route::post('merchant_license_identify', 'api.Common/merchant_license_identify');//营业执照识别
|
Route::post('merchant_license_identify', 'api.Common/merchant_license_identify');//营业执照识别
|
||||||
|
|
||||||
Route::post('user_free_trial/:id', 'api.store.product.StoreProduct/UserFreeTrial')->option([
|
Route::post('user_free_trial/:id', 'api.store.product.StoreProduct/UserFreeTrial')->option([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user