我想开发员工时钟输入和输出系统(网站).
我担心两件事:
如果工作人员从昨天开始忘记"闹钟"并且今天有'时钟输入',那么它应该标记给经理.
工作人员可能会长时间工作,例如:时钟周一上午11:00到周二上午01:30(午夜后).我不希望系统认为工作人员已经忘记了时钟..
如何解决这个问题以及数据库设计可以改进哪些方面?
员工表:
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | NO | | NULL | |
| password | varchar(50) | NO | | NULL | |
| hourly_rate | decimal(6,2) | NO | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
Run Code Online (Sandbox Code Playgroud)
时钟表:
+----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | …Run Code Online (Sandbox Code Playgroud) 当你点击li时,我想要点击输入广播.
但是,我从conole日志中得到一个错误说:
Uncaught RangeError: Maximum call stack size exceeded
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
这里是html代码:
<ul class="Method">
<li class="shipping_today active">
<label> Label 1 </label>
<input value="shipping_today" name="shipping" type="radio" />
</li>
<li class="shipping_next_month">
<label> Label 2 </label>
<input value="shipping_next_month" name="shipping" type="radio" />
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$(".Method li").click(function() {
var thisLi = $(this);
var radio = $(this).find("input:radio");
if (radio.val() == "shipping_today") {
$(".Method li").eq(1).removeClass("active");
$(this).addClass("active");
}
if (radio.val() == "shipping_next_month") {
$(".Method li").eq(-2).removeClass("active");
$(this).addClass("active");
}
radio.click(); //problem here...
});
Run Code Online (Sandbox Code Playgroud)
我的jQuery代码好吗?什么可以改善?
谢谢.
在数据库中存储商店开放和关闭时间的最佳方法是什么,以及如何计算PHP中的时间?
我想出了这个表设计:
+----+---------+----------+-----------+------------+
| id | shop_id | week_day | open_hour | close_hour |
+----+---------+----------+-----------+------------+
| 1 | 3 | 1 | 15:00:00 | 23:00:00 |
| 2 | 3 | 2 | 15:00:00 | 23:00:00 |
| 3 | 3 | 3 | 18:00:00 | 02:00:00 |
| 4 | 3 | 4 | 18:00:00 | 02:00:00 |
| 5 | 3 | 5 | 18:00:00 | 03:00:00 |
+----+---------+----------+-----------+------------+
+------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key …Run Code Online (Sandbox Code Playgroud) 我一直在阅读Laravel验证文档.我不清楚如何结合两条规则.
例如:
<input type="checkbox" name="has_login" value="1">
<input type="text" name="pin" value="">
Run Code Online (Sandbox Code Playgroud)
如果has_login勾选了复选框,pin则需要输入文本值.
如果has_login未勾选,则pin不需要输入文本.
Laravel验证:
public function rules()
{
return [
'has_login' => 'accepted',
'pin' => 'required',
];
}
Run Code Online (Sandbox Code Playgroud) 是否可以通过Electron获得唯一的PC /设备ID,以便将PC /设备ID保存到云上的MySQL Server?如果这不可能,那么我还有什么其他选择?
这样做的目的是限制他们可以使用Electron App的设备数量。
通常我将逻辑放在服务类中而不使用存储库,例如,类似这样的东西:
namespace App\ProjectName\Profile;
use App\User;
class AccountService
{
private $userModel;
public function __construct(User $userModel)
{
$this->userModel = $userModel;
}
public function detail()
{
$user = \Auth::User();
return [
'id' => $user->id,
'name' => $user->name,
'email' => $user->email,
'keys' => $user->keys,
];
}
public function addKey($name, $key)
{
return $this->userModel->keys()->create([
'name' => $name,
'key' => $key
]);
}
}
Run Code Online (Sandbox Code Playgroud)
我在那里看到了一些例子,通过创建存储库类进一步重构.类似于UserController输入数据的东西,将其发送到UserCreatorService,然后获取UserRepository其中的数据UserModel.它似乎UserCreatorService是重复的UserRepository?
我想创建每个虚拟服务器提供程序的一些类,例如:
每个Provider都有自己的PHP类(通过composer)来使用他们的API接口,我想使用他们的类库,但我想确保我可以为每个提供者使用相同的方法.例如关闭VPS:
powerOff()haltServer()而不是使用powerOff()和haltServer()- 我想为shutdown()我将创建的任何提供程序类使用方法.我应该使用策略设计还是适配器模式?
使用Raw,如何返回更新行的集合?
例如:
$updated = DB::table('users')->where('id', 1)->update(['votes' => 123]);
Run Code Online (Sandbox Code Playgroud)
我期望dd($updated)返回集合的更新行,但返回1。
{{$updated->votes}} should return 123
Run Code Online (Sandbox Code Playgroud) 根据Laravel 文档,我可以使用Queue::fake();防止作业排队。
不清楚如何在未排队的情况下测试 (PHPUnit) 作业类中的一些方法。
例如:
class ActionJob extends Job
{
public $tries = 3;
protected $data;
public function __construct($data)
{
$this->data = $data;
}
public function handle()
{
if ($this->data['action'] == "deleteAllFiles") {
$this->deleteAllFiles();
}
}
protected function deleteAllFiles()
{
//delete all the files then return true
// if failed to delete return false
}
}
Run Code Online (Sandbox Code Playgroud)
这是我要测试的示例deleteAllFiles()- 我需要模拟它吗?
我们在 github 上有数百个已不再使用的存档存储库。
默认情况下,Github 上没有隐藏存档存储库的选项。目前,浏览活跃的 repos 并不方便,尤其是在 github 上大量滚动。
我喜欢创建一个名为的新存储库,Archived并将大量存档存储库移至该存储库,但这可能吗?据我了解,一个 repo 中不能有多个 repos Archived。如果没有,还有什么其他选择?