83 lines
1.8 KiB
PHP
83 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\api\model\app\activity;
|
|
|
|
use think\Model;
|
|
use think\Db;
|
|
use app\api\model\app\activity\Ticket;
|
|
use app\common\exception\Exception;
|
|
use app\api\model\app\activity\UserTicket;
|
|
use fast\Random;
|
|
|
|
/**
|
|
* 线下活动-自定义表单
|
|
*/
|
|
class Form extends Model
|
|
{
|
|
|
|
|
|
// 表名
|
|
protected $name = 'app_activity_apply_form';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
|
|
/**
|
|
* 获取表单所属用户
|
|
* @param $userId
|
|
* @param $formId
|
|
* @return void
|
|
*/
|
|
public static function getFormUser($formId){
|
|
$formInfo = self::where([
|
|
'id'=>$formId
|
|
])->find();
|
|
|
|
if(!$formInfo){
|
|
return false;
|
|
}
|
|
|
|
return $formInfo['user_id'];
|
|
}
|
|
|
|
/**
|
|
* 获取表单字段
|
|
* @param $activityId
|
|
* @return array|array[]
|
|
*/
|
|
public function getFromField($activityId){
|
|
$activityData = \app\api\model\app\activity\Activity::getActivityDetail($activityId);
|
|
|
|
if(!$activityData){
|
|
return false;
|
|
}
|
|
|
|
$activityData['apply_info_form'] = json_decode($activityData['apply_info_form'],true);
|
|
|
|
$mustField = [
|
|
[
|
|
"required"=>true,
|
|
"name"=>"姓名",
|
|
"type"=>"input"
|
|
],
|
|
[
|
|
"required"=>true,
|
|
"name"=>"手机号",
|
|
"type"=>"input"
|
|
]
|
|
];
|
|
|
|
if($activityData['apply_info_collet'] == 1){
|
|
$mustField = array_merge($mustField,$activityData['apply_info_form']);
|
|
}
|
|
|
|
return $mustField;
|
|
}
|
|
|
|
} |