| 
									
										
										
										
											2021-11-18 17:57:04 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace app\model; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 18:21:18 +08:00
										 |  |  | use app\repository\CouponRepository; | 
					
						
							| 
									
										
										
										
											2021-11-18 17:57:04 +08:00
										 |  |  | use think\Collection; | 
					
						
							|  |  |  | use think\db\exception\DataNotFoundException; | 
					
						
							|  |  |  | use think\db\exception\DbException; | 
					
						
							|  |  |  | use think\db\exception\ModelNotFoundException; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2022-03-31 14:42:56 +08:00
										 |  |  |  * 签到券类型 | 
					
						
							| 
									
										
										
										
											2021-11-18 17:57:04 +08:00
										 |  |  |  * Class CouponType | 
					
						
							|  |  |  |  * @package app\model | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class CouponType extends Base | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:21:18 +08:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 获取全部列表 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return Collection | 
					
						
							|  |  |  |      * @throws DataNotFoundException | 
					
						
							|  |  |  |      * @throws DbException | 
					
						
							|  |  |  |      * @throws ModelNotFoundException | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public static function getList() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return self::field('id,name')->order('id', 'desc')->select(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-18 17:57:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 18:21:18 +08:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 检查类型 | 
					
						
							|  |  |  |      * */ | 
					
						
							|  |  |  |     public static  function checkType($valueData){ | 
					
						
							|  |  |  |         $type = CouponRepository::getInstance()->getCouponTypeAll(); | 
					
						
							|  |  |  |         $type = array_column($type->toArray(), null, "id"); | 
					
						
							|  |  |  |         if (!isset($type[$valueData])) { | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-18 17:57:04 +08:00
										 |  |  | } |