// +---------------------------------------------------------------------- namespace App\Models; /** * 工作管理-模型 * @author wesmiler * @since 2020/11/11 * Class WorkModel * @package App\Models */ class WorkModel extends BaseModel { // 设置数据表 protected $table = 'works'; /** * 获取记录信息 * @param int $id 记录ID * @return array|string * @author wesmiler * @since 2020/11/11 */ public function getInfo($id) { $info = parent::getInfo($id); // TODO: Change the autogenerated stub if ($info) { // 图片 if ($info['thumb']) { $info['thumb'] = get_image_url($info['thumb']); } $bookNum = WorkBooksModel::where(['aid'=> $info['id'],'mark'=> 1,'status'=> 1])->count('user_id'); $info['book_num'] = intval($bookNum); } return $info; } }