Merge branch 'master' of http://gitlab.posedu.cn:8099/cdd/employed
正在显示
5 个修改的文件
包含
107 行增加
和
2 行删除
| @@ -16,6 +16,8 @@ use PhpOffice\PhpSpreadsheet\Style\Color; | @@ -16,6 +16,8 @@ use PhpOffice\PhpSpreadsheet\Style\Color; | ||
| 16 | use PhpOffice\PhpSpreadsheet\Style\Alignment; | 16 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
| 17 | use PhpOffice\PhpSpreadsheet\Style\Border; | 17 | use PhpOffice\PhpSpreadsheet\Style\Border; |
| 18 | use PhpOffice\PhpSpreadsheet\Style\NumberFormat; | 18 | use PhpOffice\PhpSpreadsheet\Style\NumberFormat; |
| 19 | +use Endroid\QrCode\QrCode; | ||
| 20 | +use Upyun\Upyun; | ||
| 19 | 21 | ||
| 20 | function isWechat(){ | 22 | function isWechat(){ |
| 21 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { | 23 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { |
| @@ -1211,6 +1213,77 @@ if (!function_exists('cut_str')) { | @@ -1211,6 +1213,77 @@ if (!function_exists('cut_str')) { | ||
| 1211 | } | 1213 | } |
| 1212 | 1214 | ||
| 1213 | 1215 | ||
| 1216 | + /** | ||
| 1217 | + * 生成二维码 | ||
| 1218 | + * @params $link 二维码地址 | ||
| 1219 | + * @params $fileName 文件名称 | ||
| 1220 | + * @params $size 大小 | ||
| 1221 | + */ | ||
| 1222 | + function mk_Qrcode($link,$fileName,$size = 120) | ||
| 1223 | + { | ||
| 1224 | + | ||
| 1225 | + $file_name = $_SERVER['DOCUMENT_ROOT'].'/uploads/'.$fileName .'.png'; | ||
| 1226 | + $qrCode = new QrCode($link); | ||
| 1227 | + //设置前景色 | ||
| 1228 | + $qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' =>0, 'a' => 0]); | ||
| 1229 | + //设置背景色 | ||
| 1230 | + $qrCode->setBackgroundColor(['r' => 250, 'g' => 255, 'b' => 255, 'a' => 10]); | ||
| 1231 | + //设置二维码大小 | ||
| 1232 | + $qrCode->setSize($size); | ||
| 1233 | + | ||
| 1234 | + try { | ||
| 1235 | + $qrCode->writeFile($file_name); | ||
| 1236 | + } catch (\Exception $e) { | ||
| 1237 | + return false; | ||
| 1238 | + } | ||
| 1239 | + return $file_name; | ||
| 1240 | + } | ||
| 1241 | + | ||
| 1242 | + function upyun_upload($uploadFilePath){ | ||
| 1243 | + $config = get_addon_config('upyun'); | ||
| 1244 | + //创建的服务的名称 | ||
| 1245 | + $serviceName = $config['bucket']; | ||
| 1246 | + //操作员账号 $config['operator'] | ||
| 1247 | + $operator = "zhaoyang"; | ||
| 1248 | + //操作员密码 | ||
| 1249 | + $password = "Lxq0ykCsvZ6q7abFfvzw51QmcxgOxr3B"; | ||
| 1250 | + //要上传目录 | ||
| 1251 | + $directory = 'signature/'; | ||
| 1252 | + //上传文件名,对象存储其实就是一个key value的存储结构。 | ||
| 1253 | + $key = basename($uploadFilePath); | ||
| 1254 | + //又拍云默认域名 | ||
| 1255 | + $defaultDomain = $config['cdnurl']; | ||
| 1256 | + //在对象存储中,其实并没有实际意义上的"目录"(或者叫"文件夹"),整个文件夹和最后的key一起,组成的一个整体也是key | ||
| 1257 | + if($directory){ | ||
| 1258 | + //真正使用时,$directory可能是用户传过来的,在不知道用户是否写了右斜杠的情况下,统一先去掉再添加一个 | ||
| 1259 | + $key = rtrim($directory, '/') . '/' . $key; | ||
| 1260 | + } | ||
| 1261 | + | ||
| 1262 | + //使用又拍云php-sdk上传文件非常方便,很new一个config对象 | ||
| 1263 | + $serviceConfig = new \Upyun\Config($serviceName, $operator, $password); | ||
| 1264 | + // 15728640 = 15M,如果文件大于15M,则使用并行分块上传 | ||
| 1265 | + if(filesize($uploadFilePath) > 15728640){ | ||
| 1266 | + /* uploadType有两个值 | ||
| 1267 | + - BLOCK : 串行分块上传 | ||
| 1268 | + - BLOCK_PARALLEL : 并行分块上传 | ||
| 1269 | + */ | ||
| 1270 | + //然后可对new出的config对象的属性继续设置参数(有哪些参数可直接查看Config类: vendor/upyun/sdk/src/Upyun/Config.php) | ||
| 1271 | + //设置uploadType=BLOCK_PARALLEL表示使用并行分片上传 | ||
| 1272 | + $serviceConfig->uploadType = 'BLOCK_PARALLEL'; | ||
| 1273 | + } | ||
| 1274 | + $client = new Upyun($serviceConfig); | ||
| 1275 | + $fp = fopen($uploadFilePath, 'rb'); | ||
| 1276 | + $retArr = $client->write($key, $fp); | ||
| 1277 | + | ||
| 1278 | + //随便拿一个元素来判断是否上传成功 | ||
| 1279 | + if(isset($retArr['x-upyun-content-length'])){ | ||
| 1280 | + //在实际使用中,$key可能是用户传过来的,在不知道$key是否以斜杠开头的情况下,统一先去掉再自己添加一个 | ||
| 1281 | + return $defaultDomain . '/' . ltrim($key); | ||
| 1282 | + }else{ | ||
| 1283 | + return false; | ||
| 1284 | + } | ||
| 1285 | + } | ||
| 1286 | + | ||
| 1214 | 1287 | ||
| 1215 | 1288 | ||
| 1216 | } | 1289 | } |
| @@ -25,7 +25,6 @@ class Index extends Frontend | @@ -25,7 +25,6 @@ class Index extends Frontend | ||
| 25 | protected $template = 'weilai'; | 25 | protected $template = 'weilai'; |
| 26 | public function _initialize() | 26 | public function _initialize() |
| 27 | { | 27 | { |
| 28 | - dump($config = get_addon_config('upyun'));die; | ||
| 29 | parent::_initialize(); // TODO: Change the autogenerated stub | 28 | parent::_initialize(); // TODO: Change the autogenerated stub |
| 30 | $template = TemplateView::getSchoolTemplate( $this->school_id); | 29 | $template = TemplateView::getSchoolTemplate( $this->school_id); |
| 31 | $this->layout = $template->layout ?? 'default'; | 30 | $this->layout = $template->layout ?? 'default'; |
| @@ -17,6 +17,8 @@ use think\Collection; | @@ -17,6 +17,8 @@ use think\Collection; | ||
| 17 | use think\Db; | 17 | use think\Db; |
| 18 | use think\Exception; | 18 | use think\Exception; |
| 19 | use app\school\model\basic\User; | 19 | use app\school\model\basic\User; |
| 20 | +use Endroid\QrCode\QrCode; | ||
| 21 | +use think\Request; | ||
| 20 | 22 | ||
| 21 | class SignupInfo extends Frontend | 23 | class SignupInfo extends Frontend |
| 22 | { | 24 | { |
| @@ -234,7 +236,6 @@ class SignupInfo extends Frontend | @@ -234,7 +236,6 @@ class SignupInfo extends Frontend | ||
| 234 | $containerId = $params['container_id']; | 236 | $containerId = $params['container_id']; |
| 235 | $registerId = $params['register_id']; | 237 | $registerId = $params['register_id']; |
| 236 | $projectTypeId = $params['project_type_id']; | 238 | $projectTypeId = $params['project_type_id']; |
| 237 | - | ||
| 238 | //比赛信息 | 239 | //比赛信息 |
| 239 | $ProjectRegister = new ProjectRegister(); | 240 | $ProjectRegister = new ProjectRegister(); |
| 240 | $container = ProjectContainer::get($containerId); | 241 | $container = ProjectContainer::get($containerId); |
| @@ -471,6 +472,7 @@ class SignupInfo extends Frontend | @@ -471,6 +472,7 @@ class SignupInfo extends Frontend | ||
| 471 | $register_id = false; | 472 | $register_id = false; |
| 472 | //details表存的信息 | 473 | //details表存的信息 |
| 473 | $detailsAll = $params['form']; | 474 | $detailsAll = $params['form']; |
| 475 | + | ||
| 474 | try { | 476 | try { |
| 475 | $register_id = Db::transaction(function () use ($regArr , $detailsAll , $ProjectRegister,$newStudentArr,$teacherArr,$registerId,$containerId,$rateFlg){ | 477 | $register_id = Db::transaction(function () use ($regArr , $detailsAll , $ProjectRegister,$newStudentArr,$teacherArr,$registerId,$containerId,$rateFlg){ |
| 476 | if ($detailsAll){ | 478 | if ($detailsAll){ |
| @@ -483,7 +485,21 @@ class SignupInfo extends Frontend | @@ -483,7 +485,21 @@ class SignupInfo extends Frontend | ||
| 483 | $ProjectRegister->allowField(true)->save($regArr); | 485 | $ProjectRegister->allowField(true)->save($regArr); |
| 484 | $did = Db::name('project_register_details')->insertGetId(['project_details'=>json_encode($detailsAll)]); | 486 | $did = Db::name('project_register_details')->insertGetId(['project_details'=>json_encode($detailsAll)]); |
| 485 | $ProjectRegister->project_details = $did; | 487 | $ProjectRegister->project_details = $did; |
| 488 | + | ||
| 489 | + //非更新数据 生成审核二维码 | ||
| 490 | + $link = request()->domain().'/teacher/ajax/canvas?id='.$ProjectRegister->id; | ||
| 491 | + $qrUrl = mk_Qrcode($link,$ProjectRegister->id.'_register'); | ||
| 492 | + if(!$qrUrl) { | ||
| 493 | + \exception('提交失败,请重试'); | ||
| 494 | + } | ||
| 495 | + $qr_code = upyun_upload($qrUrl); | ||
| 496 | + | ||
| 497 | + if(!$qr_code) { | ||
| 498 | + \exception('提交失败,请重试'); | ||
| 499 | + } | ||
| 500 | + $ProjectRegister->qr_code = $qr_code; | ||
| 486 | $ProjectRegister->save(); | 501 | $ProjectRegister->save(); |
| 502 | + unlink($qrUrl); | ||
| 487 | }else{ | 503 | }else{ |
| 488 | $ProjectRegister->allowField(true)->isUpdate(true,['id' => $registerId])->save($regArr); | 504 | $ProjectRegister->allowField(true)->isUpdate(true,['id' => $registerId])->save($regArr); |
| 489 | $p = $ProjectRegister->find($registerId); | 505 | $p = $ProjectRegister->find($registerId); |
| @@ -144,6 +144,12 @@ | @@ -144,6 +144,12 @@ | ||
| 144 | .col-md-9{ | 144 | .col-md-9{ |
| 145 | margin-top: 30px; | 145 | margin-top: 30px; |
| 146 | } | 146 | } |
| 147 | + .verify { | ||
| 148 | + position: absolute; | ||
| 149 | + right: 25px; | ||
| 150 | + top:0px; | ||
| 151 | + border:2px solid #E5A0A9; | ||
| 152 | + } | ||
| 147 | </style> | 153 | </style> |
| 148 | <div class="rotation"> | 154 | <div class="rotation"> |
| 149 | <img src="__CDN__/assets/img/teacherRotation.png" /> | 155 | <img src="__CDN__/assets/img/teacherRotation.png" /> |
| @@ -173,6 +179,11 @@ | @@ -173,6 +179,11 @@ | ||
| 173 | <p style="margin: 0;">{$vo.container_name}</p> | 179 | <p style="margin: 0;">{$vo.container_name}</p> |
| 174 | </div> | 180 | </div> |
| 175 | <div class="program"> | 181 | <div class="program"> |
| 182 | +<!-- {if $vo.review_stage == 0 && $vo.project_approval_status == 0 && $vo.qr_code}--> | ||
| 183 | +<!-- <div class="verify">--> | ||
| 184 | +<!-- <a title="教师审核二维码" href="javascript:;" id="qr_code"><img src="{$vo.qr_code}" width="75" height="75" ></a>--> | ||
| 185 | +<!-- </div>--> | ||
| 186 | +<!-- {/if}--> | ||
| 176 | <div class="pic"> | 187 | <div class="pic"> |
| 177 | <text class="iconfont" style="font-size: 1.5rem;"></text> | 188 | <text class="iconfont" style="font-size: 1.5rem;"></text> |
| 178 | <text class="center "> | 189 | <text class="center "> |
| @@ -200,7 +211,9 @@ | @@ -200,7 +211,9 @@ | ||
| 200 | <p class="program_intro">{$vo.project_des}</p> | 211 | <p class="program_intro">{$vo.project_des}</p> |
| 201 | <p class="program_time iconfont"> {$vo.name}</p> | 212 | <p class="program_time iconfont"> {$vo.name}</p> |
| 202 | </div> | 213 | </div> |
| 214 | + | ||
| 203 | </div> | 215 | </div> |
| 216 | + | ||
| 204 | <p class="title2">项目信息 <a style="float: right; margin: 10px 10px 0px 0px;" class="btn btn-success btn-xs" href="javascript:;">{if $vo.is_captain == 2}队长{else/}队员{/if}</a></p> | 217 | <p class="title2">项目信息 <a style="float: right; margin: 10px 10px 0px 0px;" class="btn btn-success btn-xs" href="javascript:;">{if $vo.is_captain == 2}队长{else/}队员{/if}</a></p> |
| 205 | <div class="program_info"> | 218 | <div class="program_info"> |
| 206 | <table border="0" cellspacing="0" cellpadding="2rem"> | 219 | <table border="0" cellspacing="0" cellpadding="2rem"> |
| @@ -344,6 +357,8 @@ | @@ -344,6 +357,8 @@ | ||
| 344 | </td> | 357 | </td> |
| 345 | </tr> | 358 | </tr> |
| 346 | </table> | 359 | </table> |
| 360 | + | ||
| 361 | + | ||
| 347 | </div> | 362 | </div> |
| 348 | {/foreach} | 363 | {/foreach} |
| 349 | 364 | ||
| @@ -357,3 +372,4 @@ | @@ -357,3 +372,4 @@ | ||
| 357 | </div> | 372 | </div> |
| 358 | </div> | 373 | </div> |
| 359 | </div> | 374 | </div> |
| 375 | + |
| @@ -124,6 +124,7 @@ | @@ -124,6 +124,7 @@ | ||
| 124 | border: 1px solid #333; | 124 | border: 1px solid #333; |
| 125 | border-bottom: none !important; | 125 | border-bottom: none !important; |
| 126 | overflow: hidden; | 126 | overflow: hidden; |
| 127 | + position: relative; | ||
| 127 | } | 128 | } |
| 128 | .item_title{ | 129 | .item_title{ |
| 129 | display: flex; | 130 | display: flex; |
-
请 注册 或 登录 后发表评论