diff --git a/.env b/.env index 6153fd1..cf59e88 100644 --- a/.env +++ b/.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 = "博创设计" diff --git a/app/admin/logic/community/CommunityArticleLogic.php b/app/admin/logic/community/CommunityArticleLogic.php index f291c6f..78850f7 100644 --- a/app/admin/logic/community/CommunityArticleLogic.php +++ b/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(); } diff --git a/app/admin/view/community/community_article/detail.html b/app/admin/view/community/community_article/detail.html index 0183249..9510cc4 100644 --- a/app/admin/view/community/community_article/detail.html +++ b/app/admin/view/community/community_article/detail.html @@ -31,6 +31,8 @@
{$detail.user.nickname}
{$detail.user.sn}
+ +
{$detail.address}
diff --git a/app/admin/view/community/community_article/lists.html b/app/admin/view/community/community_article/lists.html index 8d9bd1d..feac6c2 100644 --- a/app/admin/view/community/community_article/lists.html +++ b/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:"状态"} diff --git a/app/admin/view/content/resource/edit.html b/app/admin/view/content/resource/edit.html index d73244e..6081919 100644 --- a/app/admin/view/content/resource/edit.html +++ b/app/admin/view/content/resource/edit.html @@ -77,7 +77,7 @@
@@ -102,14 +102,14 @@
{if $detail.image} -
- img - -
x
-
- +
+ img + +
x
+
+ {else} - + {/if}
建议尺寸:500*500像
@@ -122,22 +122,7 @@
- -
-
- 用户下载的资料附件 -
-
-
- -
- -
-
- - + {if !empty($detail.path)} @@ -145,11 +130,15 @@
- + {else/} - + {/if} + + + +
用户下载的资料附件 @@ -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 () { diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index a7a0d15..98ce00d 100644 --- a/app/api/controller/Index.php +++ b/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); } diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 4462708..a151222 100644 --- a/app/api/controller/User.php +++ b/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()); } diff --git a/app/api/logic/CommunityLogic.php b/app/api/logic/CommunityLogic.php index 1c80098..0dd41d6 100644 --- a/app/api/logic/CommunityLogic.php +++ b/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 ]; // diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 3cc23e1..2a33aa6 100644 --- a/app/api/logic/UserLogic.php +++ b/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) { diff --git a/app/api/validate/WechatMobileValidate.php b/app/api/validate/WechatMobileValidate.php index 0817d10..3c2dd62 100644 --- a/app/api/validate/WechatMobileValidate.php +++ b/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', ]; } \ No newline at end of file diff --git a/app/common/server/FileServer.php b/app/common/server/FileServer.php index 56450d2..ac5d34e 100644 --- a/app/common/server/FileServer.php +++ b/app/common/server/FileServer.php @@ -165,6 +165,7 @@ class FileServer if (!$StorageDriver->upload($save_dir)) { throw new Exception('上传失败' . $StorageDriver->getError()); } + // 图片上传路径 $fileName = $StorageDriver->getFileName(); // 图片信息 diff --git a/app/common/server/UrlServer.php b/app/common/server/UrlServer.php index f3f4485..6240d50 100644 --- a/app/common/server/UrlServer.php +++ b/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); } diff --git a/app/common/validate/UploadValidate.php b/app/common/validate/UploadValidate.php index 0e74913..6e2221e 100644 --- a/app/common/validate/UploadValidate.php +++ b/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 = [ diff --git a/public/static/admin/js/function.js b/public/static/admin/js/function.js index d43ebfd..acf88d2 100644 --- a/public/static/admin/js/function.js +++ b/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 = '
\n' + ' -a:1:{s:13:"config_server";N;} \ No newline at end of file +a:1:{s:13:"config_server";s:3:"陶";} \ No newline at end of file diff --git a/runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php b/runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php index 3b4363c..866b1cb 100644 --- a/runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php +++ b/runtime/cache/7c/cedf1d474a6f165fa5bb12d672f865.php @@ -1,4 +1,4 @@ -a:1:{s:13:"config_server";N;} \ No newline at end of file +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";}}} \ No newline at end of file diff --git a/runtime/cache/9f/d2f37875d1da637002182ec566f162.php b/runtime/cache/9f/d2f37875d1da637002182ec566f162.php index 2b9fef5..34f809f 100644 --- a/runtime/cache/9f/d2f37875d1da637002182ec566f162.php +++ b/runtime/cache/9f/d2f37875d1da637002182ec566f162.php @@ -1,4 +1,4 @@ -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";} \ No newline at end of file +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";} \ No newline at end of file diff --git a/runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php b/runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php index 3b4363c..9cc9d9e 100644 --- a/runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php +++ b/runtime/cache/ae/2fdbfae363833c61997d3a3e742b09.php @@ -1,4 +1,4 @@ -a:1:{s:13:"config_server";N;} \ No newline at end of file +a:1:{s:13:"config_server";i:13349205830;} \ No newline at end of file diff --git a/runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php b/runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php index eea5f31..a5f41dd 100644 --- a/runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php +++ b/runtime/cache/f9/bb91a1aa4584b80bdd1649c0e82e4a.php @@ -1,4 +1,4 @@ -a:1:{s:13:"config_server";s:5:"local";} \ No newline at end of file +a:1:{s:13:"config_server";s:0:"";} \ No newline at end of file