| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace App\Http\Controllers\AdminApi;
- use App\Http\Controllers\AdminController;
- use App\Servers\System\BaiduServer;
- use App\Servers\System\CommonServer;
- use App\Servers\System\SmsServer;
- use Illuminate\Support\Facades\Storage;
- class CommonController extends AdminController
- {
- /**
- * 发送短信
- * @return \Illuminate\Http\JsonResponse
- * @throws \End01here\EasySms\Exceptions\CodeErrorException
- * @throws \End01here\EasySms\Exceptions\GatewayErrorException
- * @throws \End01here\EasySms\Exceptions\MessageException
- */
- function sendSms()
- {
- $phone = request()->input('phone', '');
- $send_type = request()->input('send_type', 'default');
- if (empty($phone)) {
- return $this->apiResponseError('请输入手机号码');
- }
- $send_server = SmsServer::creatServer();
- $ret = $send_server->sendCode($phone, $send_type);
- if (!$ret) {
- return $this->apiResponseError($send_server->getErrorMsg() ?: '短信发送失败');
- } else {
- return $this->apiResponseSuccess('短信发送成功');
- }
- }
- /**
- * 获取身份证orc识别
- * @return \Illuminate\Http\JsonResponse
- */
- function getCardFrontOrc()
- {
- $commonServer = CommonServer::creatServer();
- $id_card = $commonServer->filtrationStr('id_card');//身份证正面
- if (empty($id_card)) return $this->apiResponseError( '请上传身份证正面');
- $result = BaiduServer::creatServer()->idCard($id_card);
- if ($result['code'] == 1){
- return $this->apiResponseSuccess($result['msg'],$result['data']);
- }else{
- return $this->apiResponseError($result['msg']);
- }
- }
- /**
- * 获取营业执照orc识别
- * @return \Illuminate\Http\JsonResponse
- */
- function getLicenseOrc()
- {
- $commonServer = CommonServer::creatServer();
- $license_img = $commonServer->filtrationStr('license_img');//营业执照
- if (empty($license_img)) return $this->apiResponseError( '请上传营业执照');
- $result = BaiduServer::creatServer()->businessLicense($license_img);
- if ($result['code'] == 1){
- return $this->apiResponseSuccess($result['msg'],$result['data']);
- }else{
- return $this->apiResponseError($result['msg']);
- }
- }
- /**
- * 获取阿里云临时权限
- * @return \Illuminate\Http\JsonResponse
- */
- function getAliSts()
- {
- $ret = CommonServer::creatServer()->getAliSts();
- if (empty($ret['code'])) {
- return $this->apiResponseError($ret['msg']);
- } else {
- return $this->apiResponseSuccess($ret['msg'], $ret['data']);
- }
- }
- /**
- * 获取腾讯云临时权限
- * @return \Illuminate\Http\JsonResponse
- */
- function getTxySts()
- {
- $ret = CommonServer::creatServer()->getTxySts();
- if (empty($ret['code'])) {
- return $this->apiResponseError($ret['msg']);
- } else {
- return $this->apiResponseSuccess($ret['msg'], $ret['data']);
- }
- }
- }
|