Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-php into dev
This commit is contained in:
commit
be4fe10f0c
@ -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,39 @@ 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')) . '.png';
|
||||||
|
$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,['code'=>[
|
||||||
|
'r' => 255,
|
||||||
|
'g' => 221,
|
||||||
|
'b' => 167,
|
||||||
|
'a' => 0,
|
||||||
|
]]);
|
||||||
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class QrcodeService
|
|||||||
* @param $name
|
* @param $name
|
||||||
* @return array|bool|string
|
* @return array|bool|string
|
||||||
*/
|
*/
|
||||||
public function getQRCodePath($url, $name)
|
public function getQRCodePath($url, $name,$data)
|
||||||
{
|
{
|
||||||
if (!strlen(trim($url)) || !strlen(trim($name))) return false;
|
if (!strlen(trim($url)) || !strlen(trim($name))) return false;
|
||||||
try {
|
try {
|
||||||
@ -42,6 +42,9 @@ class QrcodeService
|
|||||||
$info = [];
|
$info = [];
|
||||||
$outfile = Config::get('qrcode.cache_dir');
|
$outfile = Config::get('qrcode.cache_dir');
|
||||||
$code = new QrCode($url);
|
$code = new QrCode($url);
|
||||||
|
if(isset($data['code'])){
|
||||||
|
$code->setForegroundColor($data['code']);
|
||||||
|
}
|
||||||
if ($uploadType === 1) {
|
if ($uploadType === 1) {
|
||||||
if (!is_dir('./public/' . $outfile))
|
if (!is_dir('./public/' . $outfile))
|
||||||
mkdir('./public/' . $outfile, 0777, true);
|
mkdir('./public/' . $outfile, 0777, true);
|
||||||
|
@ -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