Browse Source

支付

master
jianglong 3 years ago
parent
commit
44b72a3780
  1. 10
      .env
  2. 13
      app/admin/logic/community/CommunityArticleLogic.php
  3. 2
      app/admin/view/community/community_article/detail.html
  4. 2
      app/admin/view/community/community_article/lists.html
  5. 43
      app/admin/view/content/resource/edit.html
  6. 2
      app/api/controller/Index.php
  7. 2
      app/api/controller/User.php
  8. 10
      app/api/logic/CommunityLogic.php
  9. 43
      app/api/logic/UserLogic.php
  10. 4
      app/api/validate/WechatMobileValidate.php
  11. 1
      app/common/server/FileServer.php
  12. 4
      app/common/server/UrlServer.php
  13. 2
      app/common/validate/UploadValidate.php
  14. 2
      public/static/admin/js/function.js
  15. 2
      runtime/cache/6d/fe2e9fa0414e226ed17523e470901f.php
  16. 2
      runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php
  17. 2
      runtime/cache/9f/d2f37875d1da637002182ec566f162.php
  18. 2
      runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php
  19. 2
      runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php

10
.env

@ -3,14 +3,14 @@ app_debug = "false"
charset = "utf8mb4"
database = "ahbcqz"
debug = "1"
# hostname = "122.114.59.173"
hostname = "127.0.0.1"
hostname = "122.114.59.173"
# hostname = "127.0.0.1"
hostport = "3306"
# password = "DP3hD2E8tTCAJcZF"
password = "123456"
password = "DP3hD2E8tTCAJcZF"
# password = "123456"
prefix = "ls_"
type = "mysql"
username = "root"
username = "ahbcqz"
[project]
admin_name = "博创设计"

13
app/admin/logic/community/CommunityArticleLogic.php

@ -11,6 +11,7 @@ use app\common\model\community\CommunityComment;
use app\common\model\community\CommunityLike;
use app\common\model\community\CommunityTopic;
use app\common\logic\CommunityArticleLogic as CommonArticleLogic;
use app\common\server\AreaServer;
use app\common\server\UrlServer;
use think\Exception;
use think\facade\Db;
@ -75,6 +76,12 @@ class CommunityArticleLogic extends Logic
$item['avatar'] = !empty($item['avatar']) ? UrlServer::getFileUrl($item['avatar']) : '';
$item['category'] = !empty($item['category']['name']) ? ($item['category']['type']==0?'需求-':'服务-').$item['category']['name'] : '--';
$item['address'] = $item['province_id']?AreaServer::getAddress([
$item['province_id'],
$item['city_id'],
]):'';
}
return ['count' => $lists['total'], 'lists' => $lists['data']];
@ -98,6 +105,12 @@ class CommunityArticleLogic extends Logic
$detail['cate_name'] = $detail['topic']['cate']['name'] ?? '';
$detail['audit_time'] = date('Y-m-d H:i:s', $detail['audit_time']);
$detail['address'] = $detail['province_id']?AreaServer::getAddress([
$detail['province_id'],
$detail['city_id'],
]):'';
return $detail->toArray();
}

2
app/admin/view/community/community_article/detail.html

@ -31,6 +31,8 @@
<div class="width-160">{$detail.user.nickname}</div>
<label class="layui-form-label ">编号:</label>
<div class="width-160">{$detail.user.sn}</div>
<label class="layui-form-label ">区域:</label>
<div class="width-160">{$detail.address}</div>
</div>
<div class="layui-form-item">

2
app/admin/view/community/community_article/lists.html

@ -114,9 +114,11 @@
like.tableLists("#like-table-lists", "{:url()}", [
{field:"user", align:"center",width: 240, title:"会员信息", templet: "#table-userInfo"}
,{field:"category", width: 150,title:"任务分类"}
,{field:"address", width: 150,title:"区域"}
,{field:"content", width: 200,title:"任务内容"}
,{field:"images", width: 250, align:"left", title:"图片", templet: "#table-image"}
,{field:"contact", width: 250, align:"left", title:"联系方式", templet: "#table-contact"}
,{field:"like", width: 100, align:"center", title:"点赞数"}
,{field:"comment", width: 100, align:"center", title:"评论数"}
,{field:"status_desc",  width: 120, align:"center", title:"状态"}

43
app/admin/view/content/resource/edit.html

@ -77,7 +77,7 @@
<select name="cid" id="cid" lay-verType="tips" lay-verify="required">
<option value="">全部</option>
{volist name="category" id="vo"}
<option value="{$vo.id}" {if $detail.cid==$vo.id}selected{/if}>{$vo.name}</option>
<option value="{$vo.id}" {if $detail.cid==$vo.id}selected{/if}>{$vo.name}</option>
{/volist}
</select>
</div>
@ -102,14 +102,14 @@
<div class="layui-input-block">
<div class="like-upload-image">
{if $detail.image}
<div class="upload-image-div">
<img src="{$detail.image}" alt="img">
<input type="hidden" name="image" value="{$detail.image}">
<div class="del-upload-btn">x</div>
</div>
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image"> + 添加图片</a></div>
<div class="upload-image-div">
<img src="{$detail.image}" alt="img">
<input type="hidden" name="image" value="{$detail.image}">
<div class="del-upload-btn">x</div>
</div>
<div class="upload-image-elem" style="display:none;"><a class="add-upload-image"> + 添加图片</a></div>
{else}
<div class="upload-image-elem"><a class="add-upload-image"> + 添加图片</a></div>
<div class="upload-image-elem"><a class="add-upload-image"> + 添加图片</a></div>
{/if}
</div>
<div class="layui-form-mid layui-word-aux">建议尺寸:500*500像</div>
@ -122,22 +122,7 @@
<div class="layui-inline">
<div class="pay-cert" id="kkk">
<input class="text" type="hidden" name="path" value="{$detail.path}" >
<div class="cert-add" style="cursor: pointer;">
<a class="upload-cert-a">+ 添加文件</a>
</div>
</div>
<div class=" layui-form-mid layui-word-aux">
用户下载的资料附件
</div>
</div>
</div>
<!--支付证书-->
<div class="layui-form-item">
<label class="layui-form-label">支付证书:</label>
<div class="layui-inline">
<div class="pay-cert" id="kkk">
<input class="text" type="hidden" name="apiclient_cert" value="{$detail.path | default = ''}" >
<?php if($detail['path'] !=''){ ?>
{if !empty($detail.path)}
<div class="cert-add" style="display: none;cursor: pointer;">
<a class="upload-cert-a">+ 添加文件</a>
</div>
@ -145,11 +130,15 @@
<img class="pay-img" src="/static/common/image/default/upload.png">
<a class="pay-img-del-x" style="display: none">x</a>
</div>
<?php }else{ ?>
{else/}
<div class="cert-add" style="cursor: pointer;">
<a class="upload-cert-a">+ 添加文件</a>
</div>
<?php } ?>
{/if}
<!--<div class="cert-add" style="cursor: pointer;">-->
<!-- <a class="upload-cert-a">+ 添加文件</a>-->
<!--</div>-->
</div>
<div class=" layui-form-mid layui-word-aux">
用户下载的资料附件
@ -249,7 +238,7 @@
//==========================================上传证书start=========================================================
like.certUpload('.cert-add', '{:url("file/other")}?local=1&sub_dir=resource', '{$storageUrl}');
like.certUpload('.cert-add', '{:url("file/other")}?sub_dir=resource', '{$storageUrl}');
//==========================================上传证书end===========================================================
// 删除按钮的显示与隐藏
$(document).on('mouseover', '.pay-img', function () {

2
app/api/controller/Index.php

@ -97,7 +97,7 @@ class Index extends Api
$result = IndexLogic::geocoder($get);
if ($result['status'] !== 0) {
return JsonServer::error($result['message']);
return JsonServer::success('','');
}
return JsonServer::success('',$result);
}

2
app/api/controller/User.php

@ -131,7 +131,7 @@ class User extends Api
}catch(ValidateException $e) {
return JsonServer::error($e->getError());
}
$result = UserLogic::getMobileByMnp($post);
$result = UserLogic::getMobileByMnp2($post);
if($result === false) {
return JsonServer::error(UserLogic::getError());
}

10
app/api/logic/CommunityLogic.php

@ -222,7 +222,7 @@ class CommunityLogic extends Logic
public static function getCate($type='')
{
$where = ['is_show' => 1, 'del' => 0];
if($type!=''){
if($type!='' || $type==0){
$where['type'] = $type;
}
$lists = CommunityCategory::field(['id', 'name','type'])
@ -495,6 +495,11 @@ class CommunityLogic extends Logic
CommunityTopic::where(['id' => $result['topic_id']])->inc('click')->update();
// 审核状态描述
$result['audit_remark_desc'] = CommunityArticleEnum::getStatusRemarkDesc($result);
$result['address'] = $result['province_id']?AreaServer::getAddress([
$result['province_id'],
$result['city_id'],
]):'';
return $result;
}
@ -521,6 +526,9 @@ class CommunityLogic extends Logic
'contact' => !empty($post['contact']) ? $post['contact'] : '',
'contact_name' => !empty($post['contact_name']) ? $post['contact_name'] : '',
'contact_time' => !empty($post['contact_time']) ? $post['contact_time'] : '',
'province_id' => !empty($post['province_id']) ? $post['province_id']:'',
'city_id' => !empty($post['city_id']) ? $post['city_id']:'',
'district_id' => !empty($post['district_id']) ? $post['district_id']:'',
'topic_id' => 0
];
//

43
app/api/logic/UserLogic.php

@ -355,6 +355,49 @@ class UserLogic extends Logic
}
}
//获取微信手机号
public static function getMobileByMnp2($post)
{
Db::startTrans();
try {
$config = WeChatServer::getMnpConfig();
$app = Factory::miniProgram($config);
// 获取 access token 实例
$accessToken = $app->access_token;
$token = $accessToken->getToken(); // token 数组 token['access_token'] 字符串
$wxMessage = ["code"=>$post['code']];
$wxMessage = json_encode($wxMessage, JSON_UNESCAPED_UNICODE);
//通过code获取access_token,openid,unionid
$requests = \Requests::post('https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token='.$token['access_token'],[],$wxMessage);
$response = json_decode($requests->body, true);
if ($response['errcode']!=0) {
throw new Exception('获取用户手机号失败');
}
$isExist = User::where([
['mobile', '=', $response['phone_info']['purePhoneNumber']],
['id', '<>', $post['user_id']]
])->findOrEmpty();
if (!$isExist->isEmpty()) {
throw new Exception('手机号已被其他账号绑定');
}
User::update(['id' => $post['user_id'], 'mobile' => $response['phone_info']['purePhoneNumber']]);
Db::commit();
return true;
} catch (Exception $e) {
Db::rollback();
self::$error = $e->getMessage();
return false;
}
}
//修改手机号
public static function changeMobile($user_id, $data)
{

4
app/api/validate/WechatMobileValidate.php

@ -7,7 +7,7 @@ class WechatMobileValidate extends Validate
{
protected $rule = [
'code' => 'require',
'encrypted_data' => 'require',
'iv' => 'require',
// 'encrypted_data' => 'require',
// 'iv' => 'require',
];
}

1
app/common/server/FileServer.php

@ -165,6 +165,7 @@ class FileServer
if (!$StorageDriver->upload($save_dir)) {
throw new Exception('上传失败' . $StorageDriver->getError());
}
// 图片上传路径
$fileName = $StorageDriver->getFileName();
// 图片信息

4
app/common/server/UrlServer.php

@ -40,6 +40,7 @@ class UrlServer
if (strstr($uri, 'https://')) return $uri;
$engine = ConfigServer::get('storage', 'default', 'local');
if ($engine === 'local') {
//图片分享处理
if ($type && $type == 'share') {
@ -48,7 +49,8 @@ class UrlServer
$domain = request()->domain();
} else {
$config = ConfigServer::get('storage_engine',$engine);
$domain = $config['domain'];
$domain = isset($config['domain'])?$config['domain']:"https://cdn.ahbcqz.com";
}
return self::format($domain, $uri);
}

2
app/common/validate/UploadValidate.php

@ -24,7 +24,7 @@ class UploadValidate extends Validate
{
protected $rule = [
'file' => 'fileExt:jpg,jpeg,gif,png,bmp,tga,tif,pdf,psd,avi,mp4,mp3,wmv,mpg,mpeg,mov,rm,ram,swf,flv,pem',
'file' => 'fileExt:jpg,jpeg,gif,png,bmp,tga,tif,pdf,psd,avi,mp4,mp3,wmv,mpg,mpeg,mov,rm,ram,swf,flv,pem,doc,doxc,excel,xls,xlsx',
];
protected $message = [

2
public/static/admin/js/function.js

@ -294,7 +294,7 @@ var like = {
elem: element
,url: url
,accept:'file'
,exts:'pem|txt|doc|docx|pdf|ppt'
,exts:'pem|txt|doc|docx|pdf|ppt|xls|xlsx'
,done: function(res, index, upload) {
var html = '<div class="pay-li">\n' +
'<img class="pay-img" ' +

2
runtime/cache/6d/fe2e9fa0414e226ed17523e470901f.php

@ -1,4 +1,4 @@
<?php
//000000000000
exit();?>
a:1:{s:13:"config_server";N;}
a:1:{s:13:"config_server";s:3:"陶";}

2
runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php

@ -1,4 +1,4 @@
<?php
//000000000000
exit();?>
a:1:{s:13:"config_server";N;}
a:1:{s:13:"config_server";a:1:{s:6:"aliyun";a:4:{s:6:"bucket";s:15:"bochuang-wechat";s:13:"access_key_id";s:24:"LTAI5t8WhSffm9KteMHriC8k";s:17:"access_key_secret";s:30:"hSnnKORIhdxycXZpCx92wjHM6x92aZ";s:6:"domain";s:22:"https://cdn.ahbcqz.com";}}}

2
runtime/cache/9f/d2f37875d1da637002182ec566f162.php

@ -1,4 +1,4 @@
<?php
//000000000000
exit();?>
a:2:{i:0;s:75:"E:\waibao\ahbcqz\server\runtime\cache\ad\710db81cabed7a4fc183cdbe36b098.php";i:1;s:75:"E:\waibao\ahbcqz\server\runtime\cache\b0\2f627ee37a64f2b7a2192d33ffb6ce.php";}
a:3:{i:0;s:75:"E:\waibao\ahbcqz\server\runtime\cache\ad\710db81cabed7a4fc183cdbe36b098.php";i:1;s:75:"E:\waibao\ahbcqz\server\runtime\cache\b0\2f627ee37a64f2b7a2192d33ffb6ce.php";i:2;s:75:"E:\waibao\ahbcqz\server\runtime\cache\a5\132d23a4f708efcceee81162e0d944.php";}

2
runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php

@ -1,4 +1,4 @@
<?php
//000000000000
exit();?>
a:1:{s:13:"config_server";N;}
a:1:{s:13:"config_server";i:13349205830;}

2
runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php

@ -1,4 +1,4 @@
<?php
//000000000000
exit();?>
a:1:{s:13:"config_server";s:5:"local";}
a:1:{s:13:"config_server";s:0:"";}
Loading…
Cancel
Save